Error codes

Interpret Sockudo HTTP, WebSocket, authentication, history, recovery, webhook, and push errors.

8 min read
View .mdEdit on GitHub

Sockudo reports failures in two places: HTTP status codes plus a JSON error body for REST calls, and error frames or WebSocket close codes for realtime connections. Find the status or code you received below, then follow the likely cause and fix.

HTTP error body

Every native HTTP API error returns the same JSON shape. code is a stable, machine-readable string; branch on it rather than on error, which is human-readable text.

{
"error": "Request must contain 'channels' (list) or 'channel' (string)",
"code": "missing_channel_info",
"status": 400
}

AI Transport validation errors add an ai_code field with the numeric AI Transport registry code.

HTTP status

StatusMeaningLikely causeAction
202Async work accepted.Push publish, device, and subscription writes are admitted and processed later.Store returned IDs and inspect status later.
400Invalid request.Malformed body, invalid channel name, limit exceeded, or an idempotency key reused with a different payload.Validate the request body against the endpoint and check feature flags.
401Authentication failed.Wrong app key or secret, stale auth_timestamp, or a signature over a different method, path, query, or body.Check app key, secret, timestamp, and signature.
403Forbidden or disabled.The app policy, push capability, or channel policy does not allow the operation.Check app policy and feature enablement.
404Not found.Unknown app ID, channel, message serial, device ID, template, or publish ID. Also returned for live-state routes on server_role = "api" pods.Check the identifier, and route live-state calls to a full server.
413Payload too large.Event, request body, or push payload exceeds the configured limit.Reduce event or push payload size, or raise the limit.
422Feature disabled.The endpoint’s feature is not configured at runtime, for example APNs Live Activity broadcast without [push.apns] broadcast settings.Configure and enable the feature.
429Rate limited.The API rate limiter or a push acceptance quota rejected the request.Back off, honor Retry-After, and inspect quota policy.
501Not implemented.The selected backend does not implement the operation.Choose a backend that supports it.
503Unavailable.Backpressure, a required coordination backend is down, an idempotent publish with the same key is still in flight, or the server is draining.Honor Retry-After when present and retry idempotent publishes with the same key.
5xxServer or dependency failure.Adapter, cache, queue, database, or provider failure.Inspect logs, metrics, adapter, cache, queue, or provider status.

HTTP error codes

codeStatusMeaning and fix
auth_failed401Request signing failed. Re-check the key, secret, clock skew, and the exact canonical path you signed.
forbidden403Authenticated, but not allowed. Check app policy, channel namespace permissions, and push capability headers.
app_not_found404No app matches the ID or key. Check the app manager and its cache TTL after creating an app.
not_found404The addressed resource does not exist or its retention expired.
missing_channel_info400A publish omitted both channel and channels.
invalid_input400The body or parameters failed validation. The error text names the field.
limit_exceeded400A configured limit, such as channels per event or batch size, was exceeded.
payload_too_large413The payload exceeds the event, push, or AI Transport size limit.
feature_disabled422The feature is not configured or enabled at runtime.
rate_limited429Rate limit or quota hit. Retry after the Retry-After interval.
backpressure503Sockudo is shedding load or an idempotent publish is still in progress. Retry after Retry-After.
service_unavailable503A required dependency is unavailable.
draining503The node is shutting down. Retry against another node.
not_implemented501The backend cannot perform the operation.
internal_error, serialization_error, header_build_error, app_validation_failed, termination_failed500Internal failure. Check server logs and metrics.

WebSocket error and close codes

Realtime errors arrive as an error frame with a numeric code, and fatal errors also close the connection with the same code. The range tells a client how to react, following Pusher conventions.

RangeClient behavior
4000–4099Do not reconnect automatically; fix the cause first.
4100–4199Reconnect with backoff.
4200–4299Reconnect immediately.
4300–4399Other errors; the connection may stay open.
CodeMeaningLikely cause and fix
4000SSL required, or a generic non-reconnectable error.The app only accepts wss://; connect over TLS. Also the fallback for errors without a dedicated code.
4001Application does not exist.Wrong app key in the connection URL, or the app was deleted.
4003Application disabled.The app was disabled; live connections are closed by the app availability check.
4004Application is over its connection quota.Raise the app’s connection limit or reduce connections.
4005Path not found.The upgrade URL is not /app/{appKey}.
4006Invalid version string format.Malformed client version parameters.
4007Unsupported protocol version.Upgrade or reconfigure the client library.
4008No protocol version supplied.The client did not send a protocol version.
4009Unauthorized.Invalid channel or user auth signature, disallowed origin, or invalid capability token.
4100Over capacity.The node reached max_connections, is shedding for memory pressure, or the client’s outbound buffer is full. Reconnect with backoff.
4200Reconnect immediately.Server-initiated reconnect, for example during shutdown draining or a force_reconnect call.
4201Pong reply not received.Network stall or a client that does not answer pings.
4202Closed after inactivity.No traffic within the activity timeout.
4300Channel error.Invalid channel name, unknown namespace, or missing channel or message.
4301Client event rejected.Client event rate limit exceeded or client event invalid. Also sent when a resume arrives and connection recovery is not enabled.
4302Watchlist limit exceeded.Too many watchlist entries. Also sent when a resume frame contains no channel positions.
4303Broadcast error.Server-side fanout failure; check server logs.

Capability-token errors

Protocol V2 capability-token expiry emits sockudo:token_expired with code 40142; clients should call their backend for a fresh token and send sockudo:auth during the 30 second grace window. Revocation emits the same event with code 40160; clients should obtain a new authenticated session before reconnecting.

CodeReasonFix
40142expiredFetch a new token and send sockudo:auth within 30 seconds.
40160revokedDo not refresh with the same identity; start a new authenticated session.

Auth failures

Most auth failures are caused by:

  • wrong app key or secret
  • stale timestamp
  • mismatched socket_id
  • signing a different channel_name than the client requested
  • mutating presence channel_data after signing
  • missing raw body for webhook validation
  • expired or revoked Protocol V2 capability tokens
  • capability-token kid, alg, jti, exp, or channel-operation map violations

Recovery failures

Recovery can fail when:

  • the client did not use Protocol V2
  • the replay buffer expired
  • the stream reset
  • the reconnect landed after retention was purged
  • adapter or cache state was unavailable

Each failed channel receives sockudo:resume_failed with one of these codes:

CodeMeaningFix
position_expiredThe requested position is older than the hot buffer and durable window, or the gap exceeds connection_recovery.max_buffer_size.Resubscribe, then backfill with channel_history and until_attach: true.
stream_resetThe channel’s stream_id changed, so earlier serials no longer apply.Discard local state for the channel and rebuild it.
continuity_unverifiableThe position is ahead, non-contiguous, duplicate, or non-progressing.Resubscribe and backfill instead of advancing the client cursor.
persistence_unavailableDurable history could not be read to prove continuity.Retry later, or resubscribe and rebuild state.

Clients should rebuild state after recovery failure.

For resume_failed with code: "position_expired", V2 clients should resubscribe and request WebSocket channel_history with until_attach: true. That backfills retained durable history up to the new subscription attach serial while live delivery continues above it.

Push errors

Push publish admission can succeed while provider delivery fails later. Errors at admission are returned synchronously; provider failures appear in publish status.

Error classTypical cause
Device not foundRegistration missing or deleted. Returns 404.
Provider token invalidAPNs, FCM, Web Push, HMS, or WNS rejected the token.
Credential missingProvider credentials are not configured.
Publish not foundStatus retention expired or ID is wrong. Returns 404.
Template not foundThe referenced push template does not exist.
Scheduled push invalidMissing notBeforeMs or scheduled time is invalid.
Provider throttledProvider rate limits or campaign burst.
Payload too largePlatform-specific push payload limit exceeded.

Next steps