AI Transport troubleshooting

Common AI Transport production issues and operator actions.

6 min read
View .mdEdit on GitHub

Each entry below starts from what you observe (an error code, a log line, a UI symptom), names the most likely cause, and gives the fix. Start with the rejection code if you have one: most AI Transport failures are explicit, validated rejections rather than silent drops, and sockudo_ai_messages_rejected_total{code} shows which codes your traffic is hitting.

Quick code lookup

CodeNameUsual cause
104000ai_invalid_transport_headerUnknown extras.ai.transport key, invalid value, or empty message_id.
104001ai_header_too_largeToo many keys, or a key or value over its byte limit.
104002ai_client_id_spoofA *-client-id header does not match the verified identity.
104003ai_event_not_permittedChannel is not an AI channel, the connection is V1, or a client published an agent event.
104009ai_presence_update_invalidMalformed sockudo:presence_update, or the sender is not a V2 presence member.
40009payload_too_largeStream content, append count, open-stream cap, or presence data exceeded.
93002mutable_not_permittedMutable messages are disabled for the channel.
40142token expiredCapability token reached exp.
40160token revokedToken jti or client_id was revoked.

Startup and setup

Sockudo refuses to start with an ai_transport error

Cause: the configuration violates the deployment matrix. Startup messages include ai_transport.enabled requires history.enabled, ai_transport.enabled requires versioned_messages.enabled, and, for horizontal adapters, require a shared history backend, require a shared version_store driver, or require a shared cache driver for orphan ownership.

Fix: enable [history] and [versioned_messages]. On any adapter other than local, use a non-memory history backend and version store and a Redis or Redis Cluster cache. See the deployment matrix.

The SDK throws 104007 when creating a client session

Cause: the server advertised its feature flags and ai-transport was not among them. The binary was built without the ai-transport Cargo feature.

Fix: rebuild with --features "v2,ai-transport,..." and confirm [ai_transport].enabled = true.

104003: “AI Transport is not enabled for this channel”

Cause: the channel name does not start with any [[ai_transport.channels]] prefix. Prefixes are plain string prefixes, so private-ai:user-42 does not match private-ai-.

Fix: rename the channel to start with a configured prefix, or add the prefix you use. Remember presence- channels need their own prefix entry.

“Unknown channel namespace”

Cause: the channel name contains : after its type prefix (for example private-ai:user-42), and the app defines no matching channel namespace.

Fix: use hyphenated names such as private-ai-user-42-sess-01J, or define the namespace in the app policy. See Configuration reference.

Publishing and permissions

104003: “agent AI events require trusted app-key publish”

Cause: an agent event (ai-output, ai-run-*, ai-step-*) was published over a WebSocket connection.

Fix: publish agent events through signed app-key HTTP. With the JS SDK, pass createAgentSession a client whose publish and mutation methods use HTTP, as the demo’s realtimeClient() does.

“AI client events require an authenticated client_id”

Cause: the WebSocket connection has no verified identity. Channel authorization alone does not establish a client_id.

Fix: connect with a capability token (or a signed-in user) so Sockudo knows who is publishing. See Authentication.

104002 ai_client_id_spoof

Cause: a run-client-id, input-client-id, or step-client-id header differs from the connection’s verified identity, or an untrusted client sent an empty sentinel.

Fix: let the SDK fill identity headers from the connection, and make the token’s x-sockudo-client-id the same ID your app uses as clientId.

104000 or 104001 on publish

Cause: an unknown transport key, a value outside its domain (for example status=done), an empty message_id, more than 32 keys in a tier, or a key or value over its byte limit.

Fix: check the header registry. Move provider-specific data into extras.ai.codec; it is bounded but not interpreted.

Mutations rejected as not permitted

Cause: the capability lacks message_*_own or message_*_any, or the actor identity does not match the original creator for an own-scoped mutation.

Fix: inspect the verified connection identity and token capability map; do not rely on body client_id. HTTP mutations without socket_id are server-privileged and bypass this check.

93002 “mutations not permitted on this channel”

Cause: message mutations are disabled for the channel by server or app policy, so ai-output cannot be created or appended. In the UI this usually shows as an empty assistant message.

Fix: enable versioned messages for the AI channel’s policy.

Streaming and runs

Appends fail with 40009 mid-answer

Cause: the output message reached max_accumulated_message_bytes (1 MiB), max_appends_per_message (4096), or the channel already has max_open_streaming_messages_per_channel (1024) streams open.

Fix: finish the message and continue in a new one, append larger fragments, or raise the cap after checking storage impact. Check that previous streams on the channel reached a terminal status. See Limits and quotas.

Run never ends

Cause: missing terminal append/update/summary or orphan TTL too high. The agent crashed, or did not call end() on every path.

Fix: call run.end(...) in a finally block and always send a final status=complete or status=cancelled. Check sockudo_ai_active_streams, terminal event rates, and ai_transport.rollup.orphan_ttl_ms.

Streams end with error-code=orphan_timeout

Cause: a message stayed in status=streaming without progress for longer than ai_transport.rollup.orphan_ttl_ms (default 60 seconds), so the orphan janitor cancelled it. This is expected after a worker crash, and unexpected when a long tool call pauses output.

Fix: keep long pauses out of an open stream (end the step or suspend the run), or raise orphan_ttl_ms. Subscribe to the ai_stream_orphaned webhook to observe these cancellations.

Suspended-state publishes

Cause: the producer continued after the suspend/continuation boundary.

Fix: reject or route through the continuation flow; audit message_id and op_id. A continuation uses the same run-id with a new invocation-id, and client inputs that re-enter a run carry run-continue=true.

Rollup latency too high

Cause: the window is too high, or flushes are slow under load.

Fix: compare sockudo_flush_latency to the configured window and lower default_window_ms.

Rollup savings too low

Cause: the window is too low, or terminal flushes dominate.

Fix: compare sockudo_appends_received_total, sockudo_appends_delivered_total, and sockudo_rollup_ratio, then raise default_window_ms if latency allows.

WebSocket upgrade fails with HTTP 400

Cause: a V2 connection sent an append_rollup_window that is not 0, 20, 40, 100, or 500 (or is outside min_window_ms/max_window_ms), or an append_mode other than delta or full.

Fix: send an allowed value or omit the parameter.

Tokens and auth

Reconnect loop on bad tokens

Cause: the client retries an expired, revoked, or malformed JWT without fetching a new one.

Fix: fix token refresh, rate-limit retry storms, and revoke compromised jti or client_id. Use authUrl or authCallback so the client fetches a token on every reconnect.

Connection closes with 4009 after sockudo:token_expired

Cause: the token expired (40142) and no sockudo:auth refresh arrived within 30 seconds, or the token was revoked (40160), which closes immediately.

Fix: configure authCallback or authUrl so refresh is automatic; for revocations, issue a new token only if the revocation was intended to end a single session.

Token refresh is rejected

Cause: the new token carries a different x-sockudo-client-id. Refresh cannot change identity.

Fix: reconnect to switch users; refresh only with a token for the same identity.

New tokens for a user are rejected after a revocation

Cause: the user’s client_id was revoked. A client_id revocation blocks every token for that identity until its TTL expires (24 hours by default).

Fix: revoke by jti to end one session. When revoking by client_id, set ttl_seconds to the lockout you actually want.

Recovery and history

History retention too short

Cause: rewind or recovery points before retained durable history.

Fix: increase [history] retention or lower the expected rewind/recovery window; watch retained gauges.

Resume fails with position_expired or stream_reset

Cause: position_expired means the requested position is older than retained history. stream_reset means the channel’s stream identity changed (for example after a history reset), so continuity cannot be proven.

Fix: resubscribe and load history with until_attach: true to rebuild a gap-free view from the new attach point. The SDKs surface this as a continuity-lost event.

Recovery fails after node loss

Cause: durable state is degraded or reset-required, or the shared cache or store is unavailable.

Fix: inspect sockudo_history_recovery_failures_total, the degraded/reset-required gauges, and store health.

Presence and push

Presence flaps during transient loss

Cause: the ungraceful timeout is zero or too low.

Fix: raise [presence].v2_ungraceful_timeout_seconds for Protocol V2 agent presence channels.

sockudo:presence_update rejected

Cause: 104009 when the connection is V1, the channel is not a presence- channel, or the sender is not yet a member; 40009 when member data exceeds 1024 bytes; a rate-limit error above update_rate_limit_per_member_per_second.

Fix: update only after subscription_succeeded, keep the payload small, and debounce status changes.

Push channel misses a user

Cause: the device is not registered, or it is not subscribed to the notification channel.

Fix: inspect push channel subscriptions and provider token state.

For scale and chaos-specific playbooks, see AI Transport production operations.

Next steps