Skip to content

Errors

Canonical Error Envelope

Structured application errors use the following envelope. Not every error currently has this shape (source reviewed 2026-09-10): SlowAPI may return a string-valued error, FastAPI request validation may return a detail array, and proxies can return non-JSON responses. Check the HTTP status, content type and value types before accessing nested fields:

{
"error": {
"code": "INVALID_API_KEY",
"message": "Human-readable error description",
"type": "authentication_error",
"param": "optional_parameter_name",
"request_id": "req_abc123",
"retryable": false
}
}
FieldDescription
codeMachine-readable error code (case may vary — see notes below)
messageHuman-readable error description
typeError classification (see below)
paramOptional: parameter name that caused the error
request_idCorrelation ID — also in X-Request-Id response header
retryableWhether the operation is safe to retry (true, false, or null if not applicable)

Envelope Variations

Most errors return the canonical {"error": {...}} envelope. Some errors (particularly validation and routing errors from the framework layer) may be wrapped in a detail field:

{
"detail": {
"error": {
"code": "UNSUPPORTED_PARAMETER",
"type": "invalid_request_error",
"param": "tools",
"retryable": null
}
}
}

Client handling: Check for error at both the top level and under detail. Always parse defensively — retryable may be null for errors where retry semantics are not applicable.

Request ID

Every response includes an X-Request-Id header. If you send an X-Request-Id header in your request, it is echoed back. Otherwise, a new ID is generated. Include this ID when reporting issues.

Error Types

TypeDescription
authentication_errorAPI key missing, invalid, or revoked
authorization_errorAccess denied to a resource
account_errorConnected account issue
not_found_errorResource not found
conversation_errorConversation continuity issue
validation_errorInvalid request parameters
invalid_request_errorRequest rejected (OpenAI-compatible type, used for unsupported parameters)
routing_errorRequest routing failure (e.g., conversation not found)
rate_limit_errorRate limit exceeded
timeout_errorRequest or upstream timeout
upstream_errorProvider returned an error
feature_unavailable_errorFeature unavailable (e.g., image generation)
api_errorGeneric API error

Error Code Case

Error codes are documented in UPPER_SNAKE_CASE for readability. Some API responses may return codes in lowercase_snake_case (e.g., conversation_not_found instead of CONVERSATION_NOT_FOUND). Always compare error codes case-insensitively when implementing error handling logic.

Authentication Errors

StatusCodeCauseAction
401INVALID_API_KEYMissing or invalid API keyCheck your API key
401MISSING_API_KEYNo Authorization headerAdd Authorization: Bearer gmk_live_...
401EXPIRED_API_KEYKey has expiredCreate a new key
401REVOKED_API_KEYKey has been revokedCreate a new key
401USER_NOT_ACTIVELinked user account disabledContact your admin

Validation Errors

StatusCodeTypeCauseAction
400UNSUPPORTED_PARAMETERinvalid_request_errorParameter not supported (e.g., tools, n>1)Remove the parameter
422VALIDATION_ERRORvalidation_errorRequest body validation failedFix the request body

Permission Errors

StatusCodeCauseAction
403TENANT_ACCESS_DENIEDNot permitted for this workspaceCheck workspace membership
403CONVERSATION_ACCESS_DENIEDAPI key doesn’t own conversationUse the correct API key
403ASSET_ACCESS_DENIEDNo access to this assetCheck conversation ownership
403MISSING_SCOPEAPI key lacks a required scope (e.g. actions:read, actions:run)Ask your workspace admin to grant the scope on the key

Routing Errors

Returned by the project-routing layer (type: routing_error) when routing headers or bindings cannot resolve an eligible destination:

StatusCodeCauseAction
404upstream_project_not_foundX-GhostMind-Upstream-Project slug not found or not activeCheck GET /v1/projects for valid slugs
403upstream_project_out_of_scopeKey not allowed to select that upstream projectAdd a routing binding or use an allowed project
404project_not_foundX-GhostMind-Project internal slug not foundVerify the internal project slug
422wrong_project_headerAn upstream project slug was passed in X-GhostMind-ProjectUse X-GhostMind-Upstream-Project instead
403project_out_of_scopeKey is bound to a different internal projectUse the key’s bound project or a key without project binding
404route_profile_not_foundX-GhostMind-Route-Profile slug not foundCheck the profile slug
422upstream_project_not_configuredNo eligible project and routing policy does not allow general spaceCreate a project or relax the tenant routing policy

Account Errors

StatusCodeCauseAction
403ACCOUNT_NOT_CONNECTEDNo active ChatGPT accountConnect an account in the dashboard
403UPSTREAM_ACCOUNT_NOT_AUTHORIZEDUpstream account tier cannot attach files to projectsUse conversation attachments instead; check capabilities.project_files
409ACCOUNT_NOT_ACTIVEAccount is not activeCheck connection status
503NO_HEALTHY_SESSIONNo healthy upstream sessionCheck connection status
503ACCOUNT_REAUTH_REQUIREDSession needs reconnectionReconnect in dashboard
503IMAGE_GENERATION_UNAVAILABLEImage generation failed (plan/quota)Do not retry blindly; check account plan

Conversation Errors

StatusCodeCauseAction
404CONVERSATION_NOT_FOUNDConversation doesn’t existVerify the ID
403CONVERSATION_ACCESS_DENIEDNot your conversationUse the correct API key
410CONVERSATION_DELETED_UPSTREAMDeleted in ChatGPTStart a new conversation
403CONVERSATION_ACCESS_LOSTAccess lostRenew the account session
419CONVERSATION_SESSION_EXPIREDSession expiredRenew the session
409CONVERSATION_CONTINUITY_LOSTParent chain brokenStart a new conversation
409CONVERSATION_PROJECT_UNAVAILABLEProject no longer availableUse a different project
503CONVERSATION_UPSTREAM_UNAVAILABLEAccount temporarily downRetry later

Project Errors

StatusCodeCauseAction
404PROJECT_NOT_FOUNDProject doesn’t existVerify the ID
422INVALID_MEMORY_POLICYInvalid memory_policy valueUse: provider_default, account_connected, or project_only
409PROJECT_ALREADY_EXISTSProject with same ID existsUse a different name
502PROJECT_CREATE_FAILEDUpstream creation failedCheck account status
502PROJECT_UPDATE_FAILEDUpstream update failedCheck account status

File / Asset Errors

StatusCodeCauseAction
413FILE_TOO_LARGEFile exceeds 10MBUse a smaller file
400UNSUPPORTED_FILE_TYPEMIME type not supportedCheck supported formats
502UPLOAD_FAILEDUpload to provider failedRetry
404ASSET_NOT_FOUNDAsset doesn’t existVerify the ID
409ASSET_NOT_READYAsset still processingPoll until ready

Audio Errors

StatusCodeCauseAction
503TRANSCRIPTION_FAILEDTranscription failedCheck audio format
504TRANSCRIPTION_TIMEOUTTranscription timed outUse shorter audio
404AUDIO_JOB_NOT_FOUNDJob doesn’t existVerify the job ID
429AUDIO_QUOTA_EXCEEDEDAudio quota exceededWait for reset

Provider Errors

StatusCodeCauseAction
429PROVIDER_RATE_LIMITEDProvider rate limitedSlow down request rate
503PROVIDER_UNAVAILABLEProvider unavailableRetry later
504PROVIDER_TIMEOUTProvider timed outRetry
400INVALID_REQUESTUpstream rejected the requestFix the request parameters
403ACCOUNT_REAUTH_REQUIREDChatGPT session expiredReconnect the account in the User App

Streaming Errors

During streaming, provider/session errors are emitted as structured response.failed lifecycle events — not as assistant content text.

See Streaming for the full SSE error contract.

error.codeHTTP equivalentretryableMeaning
ACCOUNT_REAUTH_REQUIRED403falseSession expired — reconnect in User App
PROVIDER_RATE_LIMITED429trueUpstream rate-limited
PROVIDER_UNAVAILABLE502/503trueUpstream error or unavailable
PROVIDER_TIMEOUT504trueUpstream did not respond
INVALID_REQUEST400falseUpstream rejected request
IMAGE_GENERATION_UNAVAILABLE503falseImage generation unavailable (plan/quota/feature)

Critical: Never interpret error text as assistant content. Stop reading the stream on response.failed and check error.retryable.

Retryable Errors

retryable: true indicates a potentially transient failure, not a guarantee that replaying a write is safe. After a timeout or broken stream, reconcile job/run state and possible external effects before retrying. Use bounded backoff and the operation’s idempotency contract where supported. Transient codes include:

  • PROVIDER_RATE_LIMITED
  • PROVIDER_UNAVAILABLE
  • PROVIDER_TIMEOUT
  • CONVERSATION_UPSTREAM_UNAVAILABLE
  • TIMEOUT

Not retryable — do not retry without addressing the root cause:

  • NO_HEALTHY_SESSION — no eligible session was selected. This alone does not prove permanent session death: inspect connection, pool and cooldown state. Reconnect when authentication expiry is confirmed, not for every routing failure.
  • ACCOUNT_REAUTH_REQUIRED — the session expired; reconnect in the User App
  • IMAGE_GENERATION_UNAVAILABLE — the account/plan cannot generate images for this request; retrying re-triggers the same fallback and burns quota

Next Steps