Skip to main content
Last updated on

Errors

Every SDK error is a MythosError. Node errors expose .code and .httpStatus; Python errors expose .code and .http_status.

CodeHTTPMeaning
CONFIG_ERROR500Bad or missing environment configuration; raised at startup by createMythos()
INVALID_LAUNCH_TOKEN401Invalid launch token
LISTING_NOT_REGISTERED401Launch audience is not registered with this app
PRODUCER_MISMATCH401This app is bound to a different Mythos Producer. Check MYTHOS_KEY.
TOKEN_ALREADY_CONSUMED401Launch token was reused
SESSION_REQUIRED401charge was called without a session
SESSION_EXPIRED401Session expired
INSUFFICIENT_FUNDS402Wallet balance is too low
SESSION_NOT_FOUND404Session does not exist
INVALID_USAGE400Invalid charge input, such as non-integer credits
UPSTREAM_ERROR502Mythos returned an upstream error
MYTHOS_UNREACHABLE503Mythos could not be reached
LLM_SESSION_REQUIRED—llm() has no session and no fallback
LLM_IDENTITY_REQUIRED—llm() has no identity token and no fallback

Node mapping​

Test launches report only the diagnostic codes and messages. Real sessions never report. The diagnostic request contains exactly code, step, and sdk_version; reporting failures and its two-second timeout do not alter app responses. charge() and llm() rethrow the original MythosError unchanged.

ProducerMismatchError extends InvalidLaunchTokenError in both languages, preserving legacy invalid-token handling. Producer binding applies to launch, handshake and callback tokens; see the configuration matrix.

EndpointHTTPMismatch body
Session (handleSession / Python session route)401{"success":false,"error":"This app is bound to a different Mythos Producer. Check MYTHOS_KEY.","code":"PRODUCER_MISMATCH"}
Handshake401{"error":"Producer mismatch"}
Listing callback401{"error":"Producer mismatch"}; registration callback is not invoked
Legacy requireLaunchToken / require_launch_token401Existing invalid-token response

The backend surfaces Producer mismatch to the Producer; preserve this exact copy. Logs contain only the endpoint's producer mismatch message and listingId, never the key, pkh or token.

typescript
if (err instanceof MythosError) res.status(err.httpStatus).json({ success: false, error: err.message, code: err.code });

Python mapping​

python
if isinstance(err, MythosError): return JSONResponse({"success": False, "error": str(err), "code": err.code}, status_code=err.http_status)