Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Errors

A call either throws (the request or configuration is unusable, or the host gave up) or returns a result whose status says how it went. Map provider and LLM failures are not thrown: the result still says what was understood and what was found, and the app needs that to tell the end user something useful.

Thrown

In Rust, WaylingoError (crates/waylingo/src/engine/mod.rs) covers misuse:

VariantWhen
InvalidRequestempty or over-long query, too many saved places, bad coordinates, settings out of range; on reroute, two choices for one stop or one place for two stops
UnknownResponsea response with an id the session did not issue
MissingResponsessome requests of the last batch got no response
Finishedstep after the session is done
IncompatibleResultresume got something it cannot continue
UnknownChoicea choice names something the previous result did not offer

The reqwest hosts add DriveError::Client (the HTTP client could not be built) and DriveError::Timeout (the async host’s deadline passed).

The bindings raise one exception type with these variants (crates/waylingo-ffi/src/error.rs), each with a detail string:

ExceptionWhenWhat to do
InvalidConfigan empty key without a proxy, a bad base_url, an empty model name, timeout_ms under 1,000, max_map_calls under 3, settings out of rangefix the configuration
InvalidRequestas abovefix the input
IncompatibleResultnot a result from this instance: another version, provider or signing key; no planplan again
UnknownChoicea choice not offered by the resultrebuild choices from the latest result
Timeoutthe query took longer than timeout_msretry; raise timeout_ms if it happens often
Internala bug in Waylingoreport it

The field is called detail, not message, because message clashes with the built-in property of Kotlin and Java exceptions.

Returned: status and error code

status is complete (every requested stop found; a trip may have none), partial (the route was made, some stops were not found) or failed (no usable trip; see error.code and error.message).

The codes are one fixed list (ErrorCode in crates/waylingo/src/error_code.rs). The wire names are a public contract tested in wire_names_are_stable. Codes are only ever added. A code from a newer version is read as UNKNOWN. Swift and Kotlin generate a closed enum, so a switch/when without a default branch stops compiling when a code is added. Include one.

CodeCauseRetryableNeeds user
NOT_UNDERSTOODnot a trip request, or nothing was asked foryes
NEEDS_DESTINATIONno destination named and no active route passedyes
NEEDS_CURRENT_LOCATIONthe trip starts here, but no current_location was passedyes
INVALID_PLANthe model’s plan stayed invalid after the repairsyes
NO_GEOCODEa place in the request was not foundyes
NO_ROUTEthe provider found no route between the placesyes
LLM_REFUSEDthe model declinedyes
LLM_AUTHLLM 401 or 403
LLM_QUOTA_EXCEEDEDLLM 402, or a 429 that says the quota is used up
LLM_RATE_LIMITEDLLM 429 after the retriesyes
LLM_BAD_REQUESTother LLM 3xx/4xx: usually a wrong model name or base URL
LLM_BAD_RESPONSEa 2xx in a format Waylingo cannot read
LLM_UNAVAILABLELLM 5xx or timeouts after the retriesyes
LLM_UNREACHABLEno connection to the LLMyes
PROVIDER_AUTHmap 401 or 403 (TomTom also uses 403 for some over-limit cases)
PROVIDER_QUOTA_EXCEEDEDmap 402
PROVIDER_RATE_LIMITEDmap 429 after the retriesyes
PROVIDER_BAD_REQUESTother map 4xx
PROVIDER_BAD_RESPONSEa map reply Waylingo cannot read
PROVIDER_UNAVAILABLEmap 5xx after the retriesyes
PROVIDER_UNREACHABLEno connection to the map provideryes
INTERNALa bug in Waylingo or in the host
UNKNOWNa code from a newer version

is_retryable(code) and needs_user(code) group the codes; a test checks that no code is in both groups (retry_and_ask_user_do_not_overlap). The rest (auth, quota, bad request or response) need the developer: retrying will not help and the end user cannot fix them.

Why the “needs user” codes exist: Waylingo never asks the end user anything itself, and it does not let the model guess what is missing. NEEDS_DESTINATION means the app should ask “where to?”; NEEDS_CURRENT_LOCATION means the app should pass the location, or ask where to start. See Missing context is not repaired.

Which failures fail the whole trip:

FailureEffect
the LLM stepfailed, no map calls made
geocoding a placefailed with NO_GEOCODE, or the provider error’s code
the base routefailed with the provider error’s code
TomTom’s category listwarning; searches use text only
one stop’s searchthat stop is unresolved with PROVIDER_ERROR
a HERE matrixwarning; that stop is ranked by distance from the anchor
the final routewarning; the base route and anchor ETAs are used (on a reroute with no base route to fall back on, failed)

Unresolved stops

A stop without a place does not fail the trip. It appears as an unresolved_stop feature (in the bindings, in unresolved) with a result (reason in the bindings):

ReasonMeaning
NO_CANDIDATESnothing matched within the detour limit, every match serves another stop, or (with strict_radius) nothing was within the radius; detail gives the counts
SKIPPED_BY_USERthe end user left it out; options keeps the places it offered
SKIPPED_BUDGETthe map call budget ran out before it was searched
UNSUPPORTEDthe anchor cannot be placed on this route (for example, the route is shorter than the interval, or an offset lands past the end)
PROVIDER_ERRORthe provider failed for this search; error_code says how, with the codes above
NOT_SEARCHEDthe search was set up but the result was built before its answer was processed. The engine processes every search answer before building a result, so a normal run does not produce it; it is a fallback (output.rs), and it is copied unchanged when a previous result carried it

For PROVIDER_ERROR, is_retryable(error_code) tells the app whether trying again later may help (for example PROVIDER_RATE_LIMITED). A stop-only reroute does not search unresolved stops again; see Reroute.