StreamOtter v0.2.0-rc.1
When it breaks
Follow the state first, then the error. Some failures affect one view; others pause the shared source.
Explore a view’s state
This is an explanatory diagram, not a connection to the demo. Select a state to see what it means.
authorizing → synchronizing → live ⇄ stale → resync-required
A denied or broken subscription → failed. Unsubscribe → closed.
idle
Created by subscribe(); its first synchronization attempt is scheduled for the next microtask, so listeners attached synchronously after subscribe() cannot miss it.
authorizing
Running (or awaiting) the authorize() handler for the current attempt. Announced under the previous epoch on a retry, or the empty epoch before the first attempt.
synchronizing
Authorized, the source is ready, and the snapshot handler has been called; buffering live updates behind a captured drain boundary until the snapshot and everything through that boundary reach the SDK.
live
Synchronized through the drain boundary while the source stays healthy; full-state updates continue in revision order. This means the channel is caught up to that boundary, not that wall-clock time has passed or that the application has rendered anything.
stale
Not currently delivering updates: waiting for the source, retrying after an attempt failure, or told the connection dropped. Comes with a `reason` (an ErrorCode) in every case that has one; a source problem's reason is always the normalized SOURCE_UNAVAILABLE, never the specific cause. resync() on a stale view keeps it stale until the gateway starts the new attempt.
resync-required
Automatic retries (3 attempts, 1 s then 2 s backoff) were exhausted for this incident, or an explicit resync() ran out of attempts. Call resync() to try again explicitly; the wire spelling is exactly 'resync-required'.
failed
Terminal: denied (FORBIDDEN) or a handler failed (HANDLER_FAILED, or an invalid snapshot's INVALID_PAYLOAD) for this specific subscription. The subscription is removed server-side; create a new one.
closed
Terminal, no error: unsubscribe() completed, or the owning client closed. Every state can reach closed through cleanup; the specification's diagram abbreviates that.
One failure, two perspectives
A map() handler throws while processing a source record: the source pauses, the visitor's views go stale with SOURCE_UNAVAILABLE, and the gateway's trace shows the real cause, HANDLER_FAILED.
Already-open browser view
stale / SOURCE_UNAVAILABLE
The view keeps its last data, visibly stale. A source pause is a state event; it does not invoke the subscription’s error listener.
Development gateway trace
map / failed / HANDLER_FAILED
The trace identifies the operator’s cause without exposing payloads. The production gateway has no trace endpoint.
The record is neither committed nor skipped. After the operator corrects the handler or the data and calls resumeSource(), the gateway retries that exact record; nothing is lost or replayed out of order. Every subscription waiting on that source resynchronizes once it reports ready.
A subscription that starts synchronizing while the source is already paused can receive the source’s specific reason. The normalization above describes an already-open view becoming stale.
Pausing is the default response to a bad record. In 0.2.0-rc.1 you can opt into more for two failure classes: see the source-failure policies below.
Handle state and errors separately
view.on("state", ({ state, reason }) => {
showState(state, reason);
if (state === "resync-required") {
offerRetry(async () => { await view.resync(); });
}
});
view.on("error", error => report(error));
// A source pause arrives through "state", not "error".
// A failed subscription needs a replacement subscription.The sample is type-checked against the pinned package. A rejected wait does not necessarily stop the subscription underneath it.
Error reference
The retryable flag below is the package default. Read the situation and any override: the flag alone does not describe the complete recovery policy.
UNAUTHENTICATED — Authentication is required or has expired.
The connection has no valid, unexpired identity. This is the gateway's own umbrella code for 'sign in again'; it is distinct from FORBIDDEN, which means a recognized identity may not see this particular channel.
Default retryable: true. The package's default for this code is retryable, but the gateway constructs it with retryable:false for every handshake-time rejection (missing/oversized token, authenticate() returning null, an expired principal, or revocation caught at handshake) and for session revocation. It explicitly passes retryable:true only for a session that closes because the principal's own expiresAt was reached — the one case where simply getting a fresh token is expected to work.
- authenticate() returns null, or the token is missing or over 8 KiB: handshake rejected before a connection opens.
- authenticate() returns a principal whose expiresAt is already in the past: handshake rejected.
- A previously open session's principal.expiresAt is reached while connected: the session closes and tells the client to reconnect with a new token.
- The application revokes the principal (Gateway.revoke) between handshake and use, or while authorize/snapshot is pending: the session or subscription closes immediately. A session revoked between authentication and the connection opening is refused.
- Client-side: the authenticated identityKey changes after reconnect() (a different subject/tenant): the SDK closes every prior subscription with UNAUTHENTICATED before the new identity subscribes fresh.
- Client-side: getToken() rejects, times out (10 s), or resolves to an empty string: the client enters auth-required.
Browser SDK: A connection 'state' change to auth-required, or a subscription 'state' change to failed with reason UNAUTHENTICATED (account switch); no so:error frame for the handshake-time cases, since the connection never opens.
Gateway trace: Handshake rejections are recorded: authenticateHandshake()'s reject() helper calls traces.record with stage authorize, outcome rejected, and this code as the errorCode — the same stage a successful handshake logs with outcome ok. That covers every handshake-time situation above (missing/oversized token, authenticate() returning null or an expired principal, and revocation caught before the connection opens). Only a revocation or expiry that closes an already-open session (Gateway.revoke, or the principal's own expiresAt) is untraced, visible solely as the session closing. Refused handshakes are traced at most ${HANDSHAKE_TRACE_RATE.perSecond} per second after a burst of ${HANDSHAKE_TRACE_RATE.burst}, so a flood of bad connections can't evict other traces; the gateway logs how many it skipped.
Operator log: None beyond the connection closing; the gateway does not log routine sign-out or expiry.
FORBIDDEN — This subscription is not permitted.
A recognized identity is not permitted to see this specific channel instance. The gateway also reports an unrecognized channel name or an unsupported channel version as FORBIDDEN to the browser, deliberately, so a visitor cannot enumerate which channels or versions exist. In production, parameters that fail the channel's schema are answered FORBIDDEN for the same reason.
Default retryable: false.
- The application's authorize() handler returns anything other than true, at subscribe time, at any resynchronization attempt, or immediately before a snapshot is delivered.
- The subscribed channel name does not exist in the deployed project (internally CHANNEL_NOT_FOUND; reported to the browser as FORBIDDEN).
- The subscribed channelVersion does not match the one deployed channel version (internally CHANNEL_VERSION_UNSUPPORTED; reported to the browser as FORBIDDEN).
- In production, the subscribe parameters fail the channel's paramsSchema (traced as INVALID_PARAMS; reported to the browser as FORBIDDEN, so the answer reveals neither the channel nor its parameter names). A development gateway answers INVALID_PARAMS instead.
- The application revokes access to this exact channel/params for this subject between authorize checks.
- No Origin header at all in production mode, or an Origin not on the allowed list: the handshake is rejected before the auth payload is even read.
Browser SDK: A so:error frame with code FORBIDDEN and a subscription 'state' change to failed; no data is ever sent for that subscription. For the Origin case, the connection never opens at all.
Gateway trace: Stage authorize, outcome rejected — the same path as every other handshake or channel-authorize rejection. The trace's errorCode is the real cause (FORBIDDEN for a bad Origin or a denied channel, CHANNEL_NOT_FOUND, CHANNEL_VERSION_UNSUPPORTED, or INVALID_PARAMS for a production schema mismatch) even though the browser only ever receives FORBIDDEN.
Operator log: No warning is logged for an ordinary denial; it is expected traffic, not a fault.
INVALID_PARAMS — The channel parameters are invalid.
The channel parameters on a subscribe request are invalid: not a plain object, over maxParamsBytes once canonically encoded, or a mismatch against the channel's declared parameter schema. The check runs before authorize or any handler, so it never reaches application code. In production a schema mismatch is answered FORBIDDEN instead, like an unknown channel; the other two cases are INVALID_PARAMS in both modes.
Default retryable: false.
- params is missing, not an object, or fails canonicalization (for example a non-finite number): rejected before the channel is looked up, in both modes.
- The canonical JSON encoding of params exceeds maxParamsBytes: rejected before the channel is looked up, in both modes.
- A parameter value does not satisfy the channel's paramsSchema (wrong type, out of range, or an unlisted enum value): INVALID_PARAMS with the failing path from a development gateway, FORBIDDEN from a production one.
Browser SDK: The so:subscribe acknowledgement itself carries {ok:false, error} with code INVALID_PARAMS (FORBIDDEN for a schema mismatch in production); the SDK surfaces this as that subscription's failure. No so:state or so:error frame follows, since no subscription was created.
Gateway trace: A schema mismatch is traced in both modes: stage authorize, outcome rejected, errorCode INVALID_PARAMS. Parameters that aren't an object or are too large are rejected before the channel lookup and leave no trace.
Operator log: None.
CHANNEL_NOT_FOUND — The channel is not configured.
An operator/diagnostic-only code for a subscribe naming a channel absent from the deployed project. It is never sent to a browser; the SDK only ever sees FORBIDDEN for this situation, so a visitor cannot learn which channels exist.
Default retryable: false.
- A subscribe request names a channel that is not one of the project's configured channels.
Browser SDK: Never delivered; the browser receives FORBIDDEN instead.
Gateway trace: Stage authorize, outcome rejected, errorCode CHANNEL_NOT_FOUND. Visible through GET /management/v1/traces on a development gateway.
Operator log: None beyond the trace entry.
CHANNEL_VERSION_UNSUPPORTED — The requested channel version is not deployed.
An operator/diagnostic-only code for a subscribe naming a real channel at a version the gateway does not deploy (V1 deploys exactly one version per channel name). Never sent to a browser; the SDK sees FORBIDDEN.
Default retryable: false.
- A subscribe request's channelVersion does not equal the one version the project deploys for that channel name.
Browser SDK: Never delivered; the browser receives FORBIDDEN instead.
Gateway trace: Stage authorize, outcome rejected, errorCode CHANNEL_VERSION_UNSUPPORTED.
Operator log: None beyond the trace entry.
SOURCE_UNAVAILABLE — The source is unavailable; this view may be stale.
The public, normalized reason for 'this channel's source is not healthy right now.' Whatever actually paused or degraded the source (a handler throwing, a broker outage, invalid data, a revision conflict) is collapsed to this one code before it reaches an already-active subscriber, so the browser's vocabulary for 'trust me less right now' stays small. The real cause lives in the gateway's trace and in SourceStatus.reason, never in what the subscriber is told.
Default retryable: true.
- The source is degraded or paused when a subscription's synchronization attempt begins (a new subscribe, or a retry): the attempt waits in stale, reporting the source's actual current reason if one is known, or SOURCE_UNAVAILABLE otherwise.
- An already-live or already-authorizing subscription's source transitions from ready to not-ready (Kafka rebalance, consumer crash, 12 s without fetch/heartbeat activity, or any pause below): every affected subscription is told stale with reason SOURCE_UNAVAILABLE specifically, regardless of the internal cause.
- With failureHandling, while a recovery boundary is in force: a snapshot that doesn't return the boundary's recoveryBoundaryId fails that attempt as a retryable SOURCE_UNAVAILABLE, and the view stays stale until one does.
- Client-side: the gateway cannot be reached within the connection attempt, the handshake's transport closes before completing, or a control request (unsubscribe/resync) is issued while disconnected.
Browser SDK: A subscription 'state' change to stale with reason SOURCE_UNAVAILABLE only; no so:error frame is sent for a source-caused pause (fail() is never called), so an 'error' listener is not invoked for this case.
Gateway trace: The trace's errorCode is the true cause, not SOURCE_UNAVAILABLE: for example HANDLER_FAILED (map handler threw), INVALID_PAYLOAD (bad record or bad map output), TIMEOUT (map handler timed out), or REVISION_CONFLICT (two records mapped to the same revision with different data). SourceStatus.reason carries that same true cause.
Operator log: A warning naming the source, its new status, and the true reason code — for example "Source not ready" or "Source paused on an unprocessable record; it will not be committed or skipped." A pause on a record also names its failureClass (for example mapper-error or invalid-json), the trusted classification of why the record couldn't be processed.
INVALID_PAYLOAD — The data did not match its declared contract.
Data did not match its declared JSON contract, at one of several boundaries: the raw source record, a map handler's output, or a snapshot handler's return value. Depending on which boundary, this either pauses the whole source (normalized to SOURCE_UNAVAILABLE for other subscribers) or fails just the one subscription asking for a bad snapshot.
Default retryable: false. A snapshot that regresses below revision already delivered on that subscription is reported with this code but is treated as a retryable attempt failure (stale, then automatic backoff) rather than an immediate terminal failure — the SDK's automatic-retry decision is separate from the StreamError.retryable flag.
- A raw source record is not valid JSON, exceeds maxSourceRecordBytes, or is a tombstone (V1 gives tombstones no meaning): pauses the source.
- A map handler's return value is not an array, exceeds maxMapOutputs, or one of its MappedState entries fails validation: pauses the source.
- A snapshot handler's return value is not a {revision, data} object, its data fails the channel's payload schema, or its revision is lower than one already delivered on that subscription: fails that subscription's attempt (or, for the regression case, retries it).
- A snapshot returns recoveryBoundaryId while its source has no recovery boundary in force (failureHandling only).
Browser SDK: Source-caused: stale/SOURCE_UNAVAILABLE, no error frame (see SOURCE_UNAVAILABLE above). Snapshot-caused: a so:error with code INVALID_PAYLOAD and state failed for that one subscription, or stale while the retry policy runs for a regression.
Gateway trace: Stage validate or map (source records) or snapshot (bad snapshot), outcome failed or rejected, errorCode INVALID_PAYLOAD.
Operator log: A warning with the source ID, record position, failure class (invalid-json, payload-schema, routing-invalid, tombstone, or oversize), and a redacted reason (never the offending payload).
OVERLOADED — The gateway is over its configured limits; try again later.
The gateway or one connection is over a configured limit, not a data or authorization problem. Every situation below is about volume: too many subscriptions, too many control requests, too much unacknowledged data, or a client that stopped confirming receipts.
Default retryable: true.
- A connection tries to open more than maxSubscriptionsPerConnection subscriptions.
- A connection sends control requests (subscribe/unsubscribe/resync) faster than controlRequestsPerSecond, burst 40. Malformed and unknown frames count against the same rate; a connection that runs out on them is closed with OVERLOADED.
- A client stops reading and its unsent output passes maxPendingBytesPerConnection: the gateway closes the connection without waiting for that output to drain.
- A subscription's pending byte budget (maxPendingBytesPerSubscription, or the connection/gateway-wide budgets above it) is exhausted before the client acknowledges outstanding frames.
- A client does not send a receipt within receiptTimeoutMs (5 s): its whole connection is closed with OVERLOADED.
- The gateway is not in its running state when a handshake arrives (still starting, or already stopping): the handshake is rejected before authentication runs.
- The number of open sessions plus in-flight handshakes has already reached maxConnections: the handshake is rejected.
Browser SDK: A rejected subscribe/control acknowledgement, a subscription 'state' change to stale (buffer overflow, retried with backoff) or resync-required (attempts exhausted), or the whole connection closing (receipt timeout or a rejected handshake).
Gateway trace: Stage queue, outcome rejected, errorCode OVERLOADED for a buffer overflow. The handshake-time cases above (the gateway not running, or its maxConnections limit reached) are also recorded, via the same stage-authorize/outcome-rejected handshake path as every other handshake rejection, at the same bounded rate.
Operator log: None for ordinary back-pressure. Closing a connection that stopped reading logs a warning, "Closing a connection that stopped reading".
RESYNC_REQUIRED — Automatic synchronization stopped; call resync() to try again.
Automatic synchronization gave up for this incident after maxSyncAttempts (3) tries with 1 s then 2 s backoff. It is not a dead end: calling resync() explicitly starts a fresh attempt.
Default retryable: true.
- Three consecutive synchronization attempts failed (source outage, snapshot timeout, or handler failure that keeps recurring) without reaching live.
- The SDK detects a protocol violation on delivered frames (a sequence gap, an unexpected future receipt) more times than its retry budget allows.
- An explicit resync() that runs out of attempts before the gateway starts a new one: the subscription ends in resync-required and resync() rejects with RESYNC_REQUIRED, rather than timing out.
Browser SDK: A subscription 'state' change to resync-required; ready() and resync() both reject pending waits with this code until resync() is called.
Gateway trace: The attempts leading up to it each have their own trace entries under their real cause; there is no separate trace row for exhaustion itself.
Operator log: None beyond the individual attempt failures already logged.
UNSUPPORTED_CAPABILITY — The requested capability is not supported by this gateway.
The client asked for something this protocol version does not have: an unknown Socket.IO event, an unknown field on a known request (protocol forward-compatibility), or a different protocolVersion at handshake.
Default retryable: false.
- The socket emits an event other than so:subscribe/so:unsubscribe/so:resync/so:receipt.
- A subscribe/unsubscribe/resync payload carries a field the gateway does not recognize (for example a future recovery option).
- The handshake's protocolVersion is not 1.
Browser SDK: A rejected control acknowledgement or a handshake connect_error; this would only happen with a mismatched SDK/gateway version, not from normal application use.
Gateway trace: Not recorded for the unknown-event and unknown-field cases, which resolve inside an already-open session before any trace stage runs. The handshake's protocolVersion mismatch is the exception: it is recorded like every other handshake rejection — stage authorize, outcome rejected, errorCode UNSUPPORTED_CAPABILITY.
Operator log: None.
INVALID_REQUEST — The request is malformed.
The request or frame itself is malformed at the protocol level, independent of channel parameters: a bad UUID, a missing acknowledgement callback, a reused requestId with a different payload, a malformed receipt, or (SDK-detected) a sequence gap or premature receipt.
Default retryable: false.
- subscriptionId or requestId is not a UUID, or a control call has no acknowledgement callback.
- A requestId already used on this connection is reused with a different payload.
- A so:receipt frame is missing a field or has an out-of-range sequence.
- A management API trace cursor is malformed (not from a valid page), or a management GET request declares a body (answered 400).
- Client-side: a data frame arrives with a sequence gap, or a receipt is acknowledged for a frame never sent — the affected subscription fails and needs fresh synchronization.
- The handshake's auth payload carries a field other than token or protocolVersion: the handshake is rejected.
Browser SDK: A rejected control acknowledgement, an unsolicited so:error, or (for the SDK-detected case) that subscription's failure and a required resynchronization. For the handshake case, the connection never opens.
Gateway trace: Not recorded for the protocol-frame situations above — they resolve inside an already-open session, before any trace stage runs — and the management API's malformed-cursor case is also not itself a Trace row. The one exception is the handshake's malformed auth payload, recorded like every other handshake rejection: stage authorize, outcome rejected, errorCode INVALID_REQUEST.
Operator log: None.
CONFIG_INVALID — The configuration is invalid.
The gateway's own configuration or handler registry is invalid. This is a deployment/code defect caught at construction or startup, before any listener opens — it can never occur on an open connection and is never sent to a browser.
Default retryable: false.
- createGateway() is given an invalid handler registry or invalid development options.
- A source references an unknown connection profile, or mode is neither development nor production.
- Production configuration is missing a required secret or CA file, or a Kafka connection profile's CA file cannot be read.
Browser SDK: Never; the gateway never finishes starting, so no connection can open.
Gateway trace: Never; there is no running gateway to record a trace.
Operator log: The CLI prints the validation issue and exits 2 (invalid configuration) without printing any secret value.
TIMEOUT — The operation did not complete before its deadline.
A deadline elapsed: a server handler (authorize, snapshot, or map) ran past handlerTimeoutMs, snapshot admission took longer than snapshotTimeoutMs, or a client-side wait (ready(), resync(), the initial connect) ran past its own timeout.
Default retryable: true.
- A map handler does not settle within handlerTimeoutMs (2,000 ms): pauses the source, normalized to SOURCE_UNAVAILABLE for other subscribers.
- An authorize or snapshot handler does not settle within handlerTimeoutMs, or snapshot admission exceeds snapshotTimeoutMs (10,000 ms, including the wait for a free snapshot slot): fails that subscription's attempt (stale, then retried).
- Client-side: a ready()/resync() wait, or the client's initial connection wait, exceeds its own timeoutMs.
Browser SDK: Source-caused: stale/SOURCE_UNAVAILABLE. Subscription-attempt-caused: stale, then retried per the backoff policy. Client-side wait: that specific promise rejects with TIMEOUT; the subscription or connection keeps running underneath it.
Gateway trace: Stage map, authorize, or snapshot, outcome failed, errorCode TIMEOUT.
Operator log: A warning naming the stage and the source or channel.
CANCELLED — The operation was cancelled.
A cancellation. In the SDK it is purely local: an AbortSignal passed to a wait fired, or unsubscribe() cancelled a pending attempt. The gateway uses it for one case of its own: a client that disconnects while authenticate() is still running.
Default retryable: false.
- The AbortSignal passed to ready()/resync()/the initial connect wait fires before the wait resolves.
- unsubscribe() cancels a subscription's in-flight synchronization attempt locally.
- A client disconnects mid-handshake: the gateway aborts authenticate()'s signal and rejects the handshake. An authenticate() that ignores the signal still counts against maxConnections until it settles or handlerTimeoutMs passes.
Browser SDK: The specific promise rejects with CANCELLED; no network message is sent for this reason. The handshake case has no browser left to tell.
Gateway trace: Only the handshake case: stage authorize, outcome rejected, errorCode CANCELLED, like other handshake rejections. SDK-side cancellations never reach the gateway.
Operator log: Never.
CLIENT_CLOSED — The client is closed; create a new client.
A call was made on an SDK client after close(). Entirely local; create a new client instead.
Default retryable: false.
- subscribe(), reconnect(), or a control call runs after close() has already resolved.
Browser SDK: The call throws or rejects synchronously with CLIENT_CLOSED.
Gateway trace: Never; a closed client has already released its transport.
Operator log: Never.
HANDLER_FAILED — An application handler failed.
Application handler code threw, rejected, or (for authenticate) returned a malformed result. Which handler failed determines the blast radius: a map failure pauses the whole source and is normalized away for other subscribers; an authorize/snapshot failure only fails the one subscription asking; a listener failure never leaves the browser at all.
Default retryable: true.
- map() throws or rejects while processing a source record: pauses the source (nothing is committed or skipped); every other subscription reading that source is told stale with reason SOURCE_UNAVAILABLE, never HANDLER_FAILED directly.
- authorize() or snapshot() throws or rejects for one subscription's own attempt: that subscription alone fails terminally with reason HANDLER_FAILED, delivered to the browser directly (no normalization, since it is not a shared-source problem).
- authenticate() throws, times out, or returns a value that is not a valid Principal (missing fields, or an expiresAt that is not a finite future timestamp): the handshake is rejected with HANDLER_FAILED.
- Client-side, local only: an application's own .on("data") or .on("state") listener throws synchronously or its returned promise rejects: the SDK converts this into a local HANDLER_FAILED and fails that subscription without any round trip to the gateway.
Browser SDK: The map case: only stale/SOURCE_UNAVAILABLE, no direct mention of HANDLER_FAILED. The authorize/snapshot/authenticate and local-listener cases: a so:error (or a locally constructed StreamError) with code HANDLER_FAILED and, for a subscription, state failed.
Gateway trace: Stage map, authorize, or snapshot, outcome failed, errorCode HANDLER_FAILED — this is the one place the real cause is visible for the map case. Requires a development-mode gateway's management API or a Failure Lab bench's redacted feed; the production demo gateway exposes no trace endpoint.
Operator log: A warning with the stage, channel or source ID, and the handler's (redacted) error description; for the map case, exactly: "Source paused on an unprocessable record; it will not be committed or skipped.", with failureClass mapper-error (mapper-timeout for a timeout, mapper-transient for a TransientMappingError). resumeSource() is required after the operator fixes the handler or its data — the paused record is retried, never skipped.
REVISION_CONFLICT — Conflicting data was received for the same revision.
Two source records mapped to the same channel-instance revision with different canonical data — a mapping or upstream-data bug, not a transient condition. It is the specification's own worked example of a cause that is normalized to SOURCE_UNAVAILABLE for subscribers.
Default retryable: false.
- A record's mapped output has the same revision as one already admitted for that channel instance, but the data differs (a non-idempotent replay or a mapping bug).
Browser SDK: Only stale/SOURCE_UNAVAILABLE; REVISION_CONFLICT itself never reaches the browser.
Gateway trace: Stage queue, outcome rejected, errorCode REVISION_CONFLICT; also SourceStatus.reason for the paused source.
Operator log: A warning naming the source, the position, and the conflicting revision.
TRACE_CURSOR_EXPIRED — The trace cursor has expired; start from the latest traces.
A management-API-only code: a GET /management/v1/traces cursor is from a different gateway run, or older than the retained trace window (maxTraceEntries/maxTraceBytes). Never seen by a browser SDK.
Default retryable: false.
- A trace cursor names a gateway run ID other than the current one, or points before the oldest retained trace.
Browser SDK: Never; browsers do not call the management API.
Gateway trace: This error is about the trace API itself, so it is not a Trace row; the management API responds 410 with this code.
Operator log: None beyond the 410 response to whichever tool (workbench, or a Failure Lab bench's trace poller) sent the stale cursor.
INTERNAL — An unexpected error occurred.
An unclassified fault with a correlation ID: a management API route throwing unexpectedly, a transport-level error the gateway did not anticipate, or the SDK's last-resort fallback when a terminal frame arrives with no specific reason.
Default retryable: true.
- A management API handler throws an error the router did not expect: answered 500 with code INTERNAL.
- The Socket.IO transport reports an unexpected middleware error.
- Client-side: a subscription's 'failed' or 'closed' frame carries no reason and no other error is on hand.
Browser SDK: A so:error or a locally constructed StreamError with code INTERNAL and a requestId for correlation.
Gateway trace: Not a distinct stage of its own; whatever stage was running when the unexpected fault occurred.
Operator log: An error-level log with the correlation ID and a redacted description.
Source-failure policies in [email protected]
Opt-in. Everything above is what happens without a failureHandling section, and it stays the default: a bad record pauses its source. 0.2.0-rc.1 adds policies you can turn on per source and per failure class; the installed validator accepts a failureHandling section (this demo's own configuration passes with a quarantine-hold policy added). The Handle bad records guide ↗ is the runbook. This section describes the library; what this demo runs is at the end.
A class with no policy pauses. The policies:
pause- The default, and the only behavior without a failureHandling section: the source stops at the record without committing or skipping it. With failureHandling configured, the failure is also recorded as an incident.
quarantine-hold- Copy the original record, byte for byte, to a quarantine topic you provide, wait for Kafka to acknowledge the copy, and keep the source held at the record. The release's guide suggests starting here.
quarantine-resync- After an acknowledged copy, ask your application's recovery guard. Only a recoverable answer moves the source past the record, and from then on every snapshot on the source must acknowledge the recovery boundary before a view can be live.
There is no ignore, discard, or force-skip option. Automatic continuation stops after 5 distinct incidents in 60 seconds on one source, by default; the next one is held until an operator reopens the circuit after a repair. A record with several problems takes the most serious class, so a quarantine policy never moves past a record that also has a mapping or integrity problem.
| Failure | Failure class | With no policy | The most a policy may do |
|---|---|---|---|
| The value isn't UTF-8 JSON within the nesting limit | invalid-json | Pause | quarantine-hold or quarantine-resync, set with invalidJson. |
| Routing passed, but the mapped data fails the channel's payload schema | payload-schema | Pause | quarantine-hold or quarantine-resync, set with invalidPublicPayload. |
| The map handler threw a TransientMappingError on every allowed attempt | mapper-transient | Pause | One or two more attempts (transientMapperRetries, 250 ms then 1 s, only with replaySafeMapping), then pause. |
| Any other map handler exception, or a map handler past handlerTimeoutMs | mapper-error, mapper-timeout | Pause | Pause. The incident is recorded; nothing moves past the record. |
| The map handler returned a bad tenant, parameters, revision, shape, or count; or the same revision maps to different data | routing-invalid, revision-conflict | Pause | Pause; never skipped. Repair and retry the same record. |
| A null value (tombstone), or a record over maxSourceRecordBytes | tombstone, oversize | Pause | Pause. |
| Broker, network, or authentication failure; rebalance; shutdown; journal or quarantine failure | Not a record failure | Outage and hold behavior, as without failure handling | Not a failure class: never a skippable incident. |
| Authorization failure or a slow browser | Not a record failure | Access and flow-control behavior | Not a source failure; existing isolation and overload handling apply. |
Guide §3: choose a policy ↗ · ADR-15B: failure classes ↗
Record disposition, step by step
One failing record under a quarantine policy. Each step is recorded separately, and none of them stands in for another.
Held
Every failure pauses first. With failureHandling configured, the gateway records an incident with a stable ID in its journal, a SQLite file under its state directory (in memory only under streamotter dev without one). If it can't record the incident, the source stays paused.
Doesn't mean: Nothing has been saved, skipped, or repaired yet.
Terms:
detected,held· Source ↗Evidence saved
A quarantine policy writes the original key, value, and headers to the quarantine topic and waits for Kafka's acknowledgment (acks=all). Only an acknowledged write counts. A timeout is recorded as unknown, never as saved, and the source stays held. A fixture source keeps its evidence locally, labeled as fixture evidence.
Doesn't mean: Saved evidence isn't a repaired record or a recovered view.
Terms:
quarantine-unknown,quarantined· Source ↗Hold, or ask the recovery guard
quarantine-hold stops here: the source stays held until the cause is fixed and the same record is retried. quarantine-resync asks the source's recovery guard, one call at a time with a 10-second limit. A hold answer, a throw, a timeout, or an invalid answer keeps the source held, and the gateway refuses to start a quarantine-resync source without a guard.
Doesn't mean: A recoverable answer is the application's attestation; StreamOtter checks the boundary's identity and lifecycle, not the business data.
Terms:
guard-pending,denied,boundary-in-force· Source ↗Source advanced
The gateway journals the recovery boundary and its intent to advance, commits exactly the next offset, and reads the commit back. If the read-back fails or disagrees, the advance is uncertain and the whole source holds until a restart reconciles it.
Doesn't mean: Advancing past the record doesn't mean any browser received it.
Terms:
advance-pending,advance-confirmed,uncertain· Source ↗Views resynchronized
From then on every snapshot on the source, for new subscriptions and after restarts too, receives recovery and must return the same recoveryBoundaryId before a view can be live. A snapshot that doesn't keeps its view stale and is retried.
Doesn't mean: A resynchronized view starts from a fresh snapshot; the excluded and intermediate events aren't replayed.
Terms:
recovery,recoveryBoundaryId· Source ↗
What the browser sees
Subscription states don't change. held, quarantine-unknown, advance-confirmed, and the rest are incident facts for operators, not SDK states. An affected view goes stale with SOURCE_UNAVAILABLE, as without a policy, and becomes live again only through a fresh snapshot that satisfies the recovery boundary. There is no “live with gaps” state.
Operator actions on one incident
Commands of the local streamotter CLI, which reaches the gateway through its operator socket on the gateway's own machine. They are never browser controls, and visitors to this site can't reach them. Every action that changes state names the revision it expects; there is no force, wildcard, or bulk form.
| Command | What it does | Changes state |
|---|---|---|
streamotter status | Whether anything is held, whether the journal is healthy, and whether a circuit is open. | No |
streamotter failures list | Open incidents, oldest first; filter by source or state. | No |
streamotter failures show | One incident: evidence, quarantine, source position, and recovery kept separate, with the supported next step. | No |
streamotter failures export | A reproduction bundle for a bug report. Original bytes only when explicitly requested. | No |
streamotter sources retry-current | Process the held record again after a repair. It never skips the record. | Yes |
streamotter sources reassess | Ask the recovery guard again for an eligible quarantine-resync incident. It can't override an integrity failure. | Yes |
streamotter sources reopen-circuit | Close a tripped circuit breaker after a fix. It approves no record. | Yes |
streamotter sources retire-boundary | Retire a recovery boundary by hand, only in operator retirement mode. The unsafe option: it asserts every later snapshot already reflects the record. | Yes |
streamotter failures evaluate | Run the current mapping on the saved record without delivering, tracing, or committing. When a redrive is allowed, it issues a single-use plan that expires after 5 minutes. | No |
streamotter failures redrive | Run an approved plan through the gateway's normal revision checks. Nothing is published to Kafka and no offset moves. | Yes |
A redrive records one of four outcomes. None of them means a business action completed or that every browser rendered the result.
reprocessed- At least one subscription took the result.
superseded- Current state was already newer, so nothing older overwrote it.
failed- The record still doesn't map cleanly, for example to a conflicting revision. Nothing is admitted.
unknown- The process stopped between intent and result. It's reported after restart, needs a new approval, and is never rerun automatically.
Guide §5.2: act ↗ · V1.1 API §6: operator service ↗ · ADR-15C ↗
What this demo runs
The live creek's gateway and the walkthrough configure no failure policies: a bad record on the creek pauses its source, as described above. Only the Failure Lab's benches can run with failure handling, each bench's gateway on its own copy of the creek, and only when the Lab's deployment turns it on with LAB_FAILURE_HANDLING; it is off unless set. Set to retry, the benches get bounded retries for transient mapper errors. Set to quarantine, for a deployment whose Kafka authorization is verified for it, they also quarantine with a recovery guard. The Lab's Source failures track lists the exercises built on these policies; it asks the demo's backend which of them its benches can run, and gives the reason for any it can't.