Errors
Every Atlas SDK reports a failure the same way: a stable code (the same
snake_case string on iOS, Android, React Native, Flutter and the server
client), a message that says what to fix and ends with a link to its entry
below, and whether trying again later can work.
| Error type | Retry? | Support | |
|---|---|---|---|
| iOS (Swift) | AtlasError | isRetryable | requestId |
| Android (Kotlin) | AtlasException | isRetryable | requestId |
| React Native | AtlasError | retryable | requestId |
| Flutter | AtlasException | isRetryable | requestId |
| Servers (TypeScript) | AtlasApiError, AtlasTransportError, AtlasConfigurationError | retryable | requestId |
retryAfterSeconds says how long to wait when the service said (a rate limit,
or a service that is briefly unavailable). requestId is the service's id for
the request: quote it to support. When the service explains a failure, its
explanation is the message; otherwise the SDK writes one.
Handling errors
do {
let route = try await routes.route(from: origin, to: destination)
map.show(route)
} catch let error as AtlasError {
if error.code == "outside_coverage" { showStatus("Atlas routes in the UK") }
else if error.isRetryable { showStatus("No connection: trying again") } // error.retryAfterSeconds, when the service said
else { log(error) } // error.message says what to fix
}try {
val route = routes.route(origin, destination) // off the main thread
} catch (error: AtlasException) {
if (error.code == "outside_coverage") showStatus("Atlas routes in the UK")
else if (error.isRetryable) showStatus("No connection: trying again") // error.retryAfterSeconds, when the service said
else log(error) // error.message says what to fix
}import { AtlasError } from "@meridianatlas/react-native";
try {
const route = await routes.route({ origin, destination });
} catch (error) {
if (!(error instanceof AtlasError)) throw error;
if (error.code === "outside_coverage") showStatus("Atlas routes in the UK");
else if (error.retryable) showStatus("No connection: trying again"); // error.retryAfterSeconds, when the service said
else console.warn(error.message); // says what to fix
}try {
final route = await routes.route(origin: origin, destination: destination);
} on AtlasException catch (error) {
if (error.code == 'outside_coverage') {
showStatus('Atlas routes in the UK');
} else if (error.isRetryable) {
showStatus('No connection: trying again'); // error.retryAfterSeconds, when the service said
} else {
log(error.message); // says what to fix
}
}On a server:
import { AtlasApiError, AtlasTransportError } from "@meridianatlas/api";
try {
await atlas.route({ origin, destination, profile: "quickest" });
} catch (error) {
if (error instanceof AtlasApiError && error.code === "outside_coverage") console.warn(error.message);
else if ((error instanceof AtlasApiError || error instanceof AtlasTransportError) && error.retryable) console.warn("Try again later");
else throw error;
}Your first fifteen minutes
These are the failures a new integration meets first. The same table is
conformance/sdk-errors-v1.json, which every SDK's tests check.
| Code | Usually means | Retry? |
|---|---|---|
missing_api_key | The configuration's key is empty | No |
invalid_api_key | The key is wrong, revoked or expired | No |
wrong_service_address | The service address points at something else | No |
network_error | Offline, or nothing at the address | Yes |
request_timeout | No answer in time | Yes |
rate_limit | Too many requests | Yes, after retryAfterSeconds |
outside_coverage | A point outside the UK | No |
route_unresolved | No route between the points | No |
location_permission_required | The user hasn't allowed location | No |
location_accuracy_reduced | Only approximate location | No |
viewer_unavailable | The map viewer didn't load | Yes |
Keys and accounts
missing_api_key
The configuration was made with an empty key, so nothing was sent. Make a key
in Atlas Studio (an app key for an
app, with your bundle ID or package name; a server key for your servers)
and pass it to the configuration. Keep it out of source control: a build
setting, an .xcconfig or local.properties you don't commit, or your
server's secret store.
invalid_api_key
HTTP 401: the service refused the key. It is mistyped or cut short (Atlas Studio shows the secret once, when the key is made), revoked, or expired (a rotated key's old secret stops after 7 days). The message says which when the key itself is right but no longer active. Make a new key in Atlas Studio if you no longer have the secret.
capability_required
HTTP 403: the key doesn't have the feature this call needs; capability names
it (core_routing, navigation, map_tiles, places, …). Turn it on for the
key in Atlas Studio. A first route and guidance need Routes
(core_routing), Navigation (navigation) and Maps (map_tiles).
app_not_allowed
HTTP 403: an app key used from an app it doesn't list. Make the clients from
the configuration (it sends your bundle ID or package name, and on Android your
signing certificate), and list the app on the key. On Android, add each
certificate's SHA-256 (debug and release are signed differently:
./gradlew signingReport shows both).
billing_inactive
HTTP 402: the account can't be charged. Check billing in Atlas Studio.
usage_policy_required
HTTP 402: the account has no usage package for this feature. Choose one in Atlas Studio.
usage_allowance_exhausted
HTTP 402: this period's allowance for the feature is used up. Raise it in Atlas Studio, or wait for the next period.
Reaching the service
wrong_service_address
Something answered HTTP 404 or 405, but not as the Atlas service: the
configuration's service address points at a web page, a typo or another
server. Leave the address out to use the default,
https://api.meridianatlas.dev, or use the one Meridian gave you. The service
address is baseURL on iOS and baseUrl elsewhere; the map viewer's
(viewerURL, viewerUrl) is separate.
network_error
No answer at all: the device is offline, the address has no server, or (on Android) the platform refused plain HTTP to a development host, which the message says. Try again when the connection is back. If it never works, check the service address. Retryable.
request_timeout
No answer within the request's deadline (30 seconds unless the configuration says otherwise). Try again; allow longer with the configuration's timeout if your requests are large (a 25 × 25 route matrix). Retryable.
rate_limit
HTTP 429: too many requests for this key and feature in a minute.
retryAfterSeconds says when to try again (the service sends it as
Retry-After and in the body). If it keeps happening, spread the requests out
or ask Meridian for a higher limit. Retryable.
invalid_response
A successful answer that isn't an Atlas response: not JSON, or larger than the SDK accepts. Usually a wrong service address, or a network that needs a sign-in page first (hotel or train Wi-Fi).
service_error
Any other failure; status has the HTTP status. Retryable when the status is
500 or more (the service, or something in front of it, is briefly
unavailable); give support the requestId if it keeps failing.
invalid_request
HTTP 400 or 422: the request was refused as malformed, or the SDK refused it before sending (a coordinate out of range, a bad time-out). The message names the field. The API reference has each request's shape.
Routes
outside_coverage
The origin or destination is outside the area Atlas routes: the UK at launch.
Choose points in the UK. The service answers route_unresolved with
outsideCoverage (origin or destination) in the body, which the SDKs
report as this code.
route_unresolved
No route between the points: an island with no car ferry, or a point far from any road a car can reach. The message says which end failed and how far Atlas looked for a road.
Navigation legs
leg_invalid
The navigation leg has ended, is more than 24 hours old, or has had its 50 reroutes. Start a new leg. A session made with a configuration carries on without it: its reroutes are charged as routes.
leg_destination_mismatch
A reroute in a leg goes somewhere else (more than 50 m from the leg's destination). A new destination is a new leg.
leg_not_found
The navigation leg is unknown. Start a new one.
leg_registration_failed
To a navigation session's error callback: it couldn't register its navigation
leg after retrying. Guidance carries on, and its reroutes are charged as
routes. The cause (its capability and status) says why: usually a key
without Navigation (navigation).
Location
location_permission_required
Navigation or free drive began without location permission. Ask the user
first: When In Use on iOS (NSLocationWhenInUseUsageDescription in
Info.plist), ACCESS_FINE_LOCATION together with ACCESS_COARSE_LOCATION
on Android (Android 12 and later ignore a request for fine alone). React
Native and Flutter reject begin with this code; on Android,
ForegroundLocationSource.checkAvailable() throws it; on iOS, where your app
owns location, AtlasError.location(manager) returns it:
if let problem = AtlasError.location(manager) { // location_permission_required or location_accuracy_reduced
showStatus(problem.message)
return
}
manager.startUpdatingLocation()val gps = ForegroundLocationSource(context)
try {
gps.checkAvailable() // location_permission_required or location_accuracy_reduced
gps.start { sample -> host.ingest(sample) }
} catch (error: AtlasPluginException) {
showStatus(error.message ?: error.code)
}location_accuracy_reduced
The user allowed only approximate location (iOS's Precise Location off;
Android's "Approximate"), which is kilometres out and too coarse to navigate
by. Ask for precise location: on iOS,
requestTemporaryFullAccuracyAuthorization(withPurposeKey:) with a purpose in
NSLocationTemporaryUsageDescriptionDictionary, or send the user to Settings;
on Android, ask for ACCESS_FINE_LOCATION again.
The map
viewer_unavailable
To the map's error callback: the map viewer page didn't load. It was
unreachable (offline) or answered with an HTTP error (a wrong viewer address).
Check the configuration's viewer address (viewerURL on iOS, viewerUrl
elsewhere; the default is https://maps.meridianatlas.dev/v1) and the
connection, then show the map again. The map's other codes,
scene_unavailable, viewer_error, context_lost, route_too_large,
invalid_route and unsupported_contract, are in each quickstart's "Showing
the map".