Wiki Reference
Error codes
Every ERROR frame code a Mirexa node sends — what it means, whether the request was applied, whether to retry, and how the SDKs surface it.
When a Mirexa node refuses a request it answers with an ERROR frame carrying a 16-bit code,
an optional retry hint and a human-readable message. The code is the part a client branches
on; the message explains it to a person and must never be parsed. This page lists every
code, what it means, whether anything was applied, and what a client should do.
The ERROR frame's layout is in Wire protocol. Query
statuses (stream not found, invalid range) are not errors; they travel inside a
QUERY_RESPONSE and are listed at the end.
The one question: was it applied?
A client deciding what to do after a failure needs to know whether the request took effect. Mirexa's node is built so that almost every refusal answers that question with no: the payload is parsed, the permission checked and placement checked (redirect, fencing epoch, cutover drain, partition availability) before anything is dispatched to storage.[1] A request refused at any of those steps provably did nothing, so sending it again is a first attempt.
Two outcomes are different:
Internalmeans the node failed while doing the work. The request's fate is unknown.- A connection that dies while a write is in flight produces no code at all. The SDKs call
this an ambiguous write (
ErrAmbiguousin Go,AmbiguousWriteErrorin Python): the batch may or may not be stored.
In both cases, reconcile by reading the range back rather than re-sending blindly. A re-sent candle batch whose bars are already stored is restated and found unchanged, so it writes nothing, but that relies on details of routing a client cannot see; reading back is the reliable answer. See Durability and acknowledgements.
Summary
| Code | Name | Applied? | Retry hint | Retry? | Connection |
|---|---|---|---|---|---|
0x0001 |
Protocol |
No | — | No; fix the request | stays open (except a malformed INIT) |
0x0002 |
PayloadTooLarge |
No | — | No; split it | closed for an oversized frame; open for an over-cap batch |
0x0003 |
Unauthorized |
No | — | No; fix the token or grant | closed at the handshake or on an expired/revoked session; open for a missing permission |
0x0004 |
Internal |
Unknown | — | Not blindly; read back | stays open |
0x0005 |
Unsupported |
No | — | No | stays open |
0x0006 |
SlowConsumer |
n/a (a subscription ended) | — | Re-subscribe | stays open |
0x0007 |
Overloaded |
No | yes | Yes, after the hint | stays open |
0x0008 |
StalePlacement |
No | 250 ms | Later, after the node catches up | stays open |
0x0009 |
PartitionUnavailable |
No | none, by design | Later, after failover | stays open |
0x000A |
DerivedStream |
No | — | Only deliberately, with OVERWRITE |
stays open |
0x000B |
HistoryRequired |
No | — | Re-send with HISTORY |
stays open |
Each code's lowercase name (protocol, payload_too_large, … history_required) is also
the error_type label of mirexa_errors_total{component="network"}, incremented once per
ERROR frame the node sends; any other value would be labelled unknown.[2] See
Metrics.
The codes
0x0001 Protocol
The frame or its payload is malformed, or the request is well formed but cannot be
accepted as asked. Sources include: a payload that fails to parse (bad CRC, wrong length,
reserved bits, an invalid stream id or timeframe, a non-finite or inconsistent candle); a
candle batch the stream cannot take, with the reason in the message (bars unaligned to the
timeframe, a write into a filed market closure, a correction past the newest stored bar, a
batch wider than the hot cache); HISTORY and CORRECTION set together; a rollup the
derivation rules cannot answer; a fencing epoch prefix that fails its CRC; metadata the node
refuses; and a malformed INIT.[3]
The whole batch is refused; no record of it is stored.[4] Re-sending it unchanged gets
the same answer. A malformed INIT is answered with this code and the connection is closed.
0x0002 PayloadTooLarge
Two cases:
- A frame header announces a payload longer than
network.max_frame_payload_bytes(default 16 MiB). The payload is never read, so the node cannot find the next frame: it sends this error, naming the limit, and closes the connection.[5] - A
QUERY_MULTInames more sub-queries thannetwork.max_subqueries_per_request(default 128). The batch is refused whole, never truncated, and the connection stays open. Split the batch.[6]
0x0003 Unauthorized
Authentication or authorization failed.[7]
- At the handshake (correlation id 0, then the connection closes): the token has expired; it expires more than one hour ahead; its signature is not from a trusted key (or no token was supplied to a node with authentication on); its signing key has been revoked; or it requests a permission bit the node does not define.
- On a request (the connection stays open): the session's grant lacks the permission the
request needs, for example
session lacks the write_candles permission. - On a session that has expired or whose key was revoked: the next frame is refused and the connection is closed. A subscriber is disconnected without a frame.
- On a
REAUTH: the renewal token was refused for one of the handshake's reasons, or it names a different tenant. The session continues under its old token.
Fix the token or the node's configuration; see Permissions and Authentication and tokens.
0x0004 Internal
Something failed on the node: an I/O error, a failed persist, a bug. The message is generic
(ingest failed, query failed) so that internal paths do not leak; the cause is in the
node's log at ERROR level.[8]
For a read, repeating it is harmless. For a write, the outcome is unknown: do not replay it blindly. Read the range back and re-send what is missing.
0x0005 Unsupported
The node does not implement what was asked:[9]
- a frame type it does not know, or one it only sends (a client-sent
REDIRECT_COMMAND); this is how an older node answers a newer client's frame; - a
SUBSCRIBEwith the partials flag, which is not implemented (the ingest path produces closed candles only); - a
SUBSCRIBEbeyondnetwork.subscription.max_per_connection(default 256).
0x0006 SlowConsumer
A subscription was evicted because the client did not drain it: the node dropped
network.subscription.drop_limit batches in a row (default 10,000), or a bounded-ack
subscription's buffer overflowed. The frame carries the subscription's tag (the SUBSCRIBE's
correlation id). Only that subscription ends; the connection, its other subscriptions and
in-flight queries continue.[10] Re-subscribe, using backfill from the last timestamp
received to close the hole.
0x0007 Overloaded
The request was shed before anything was dispatched: nothing was stored, so the whole
request may be sent again, ideally after the retry after hint.[11] It is the only
code the SDKs treat as retryable. The node sends it for three reasons:
| Reason | Hint | Message begins |
|---|---|---|
| A write buffer stayed full past the admission wait (load shedding) | the expected wait, at least 1 ms, capped at 65,535 ms | server overloaded: |
| The stream's partition is frozen while it is moved to another node (a cutover) | 100 ms | partition is draining for a cutover |
| This node was just made the partition's primary and is replaying what its copy held | 250 ms | partition N is not served yet |
A client seeing load shedding should slow down, not just retry in a tight loop; under ordinary overload the node first stops reading the socket, which applies TCP backpressure, and sheds only when that wait runs out.
0x0008 StalePlacement
The node cannot place the request because it is the one that is behind: a fenced write
carried a partition epoch newer than this node has applied, or this node has no placement for
a partition the client already holds an epoch for. Nothing was dispatched. The hint is
250 ms.[12] Retry after the hint; the node catches up by applying the control plane's
log. It is distinct from a redirect (the node knows where the partition is) and from
Overloaded (a capacity problem).
0x0009 PartitionUnavailable
Nobody can serve the stream's partition right now. Either its primary is on a node the cluster has fenced (declared dead), or the primary is this node and it holds no current lease from the control plane, so it cannot rule out having been replaced. The message names the partition and node. Nothing was dispatched.[13]
It deliberately carries no retry hint: it resolves when the node is acknowledged again or the cluster fails the partition over to an in-sync copy, on a clock the client cannot see (about two liveness timeouts after the failure). Retry later; a read that tolerates staleness can ask an in-sync copy instead (see Reads from copies).
0x000A DerivedStream
A write to a derived stream — one the node writes itself from a source stream — that did not
carry the OVERWRITE flag. Nothing was stored.[14] Re-sending the same frame changes
nothing; re-sending with OVERWRITE is a deliberate decision that the client's bars replace
the node's (and a later re-derivation of the same bar replaces them again). See
Derived streams and lineage.
0x000B HistoryRequired
A plain or correction write of bars the stream has no chunk for and its hot cache cannot
reach: older than anything stored, or in a span between chunks. Only the history route
installs such bars. Nothing was stored.[15] Re-send the same bars with the HISTORY
flag; a client may do this on the code alone, as mirexa-cli load does.
How the SDKs surface errors
Go (Go SDK): a server ERROR becomes a *client.RemoteError with Code,
Message and RetryAfterMillis; reach it with errors.As. errors.Is(err, client.ErrRemote) matches any of them, and errors.Is(err, client.ErrSlowConsumer) matches
code 0x0006. RemoteError.RetryAfter() returns (hint, true) only for Overloaded.[16]
The client package exports named constants for codes 0x0001–0x0007 and 0x000A;
compare StalePlacement, PartitionUnavailable and HistoryRequired by value
(client.ErrorCode(0x000B)).
- The client re-sends
Overloadedby itself for acknowledged writes and for request/response reads, honouring the hint with jittered exponential backoff (defaults: up to 1,000 attempts, 5 ms base, 250 ms cap), and returnsErrRetriesExhaustedwrapping the last error if every attempt is shed.[17] Fire-and-forget writes andSUBSCRIBEare not re-sent. - No other code is retried. In particular
StalePlacementis returned to the caller even though it carries a hint. - A resuming subscriber treats
PartitionUnavailableand any hinted refusal as transient and keeps trying; any otherRemoteErrorends it. - A redirect is not an error code: it arrives as
*client.RedirectError(ErrRedirect), which the single-node client does not follow. - Transport failures are separate sentinels:
ErrAmbiguous(a write whose connection died in flight),ErrRequestTimeout,ErrClientClosed.
Python (Python SDK): mirexa.errors.RemoteError carries code,
message and retry_after_ms; ErrorCode is an IntEnum of all eleven codes. Subclasses
exist for OverloadedError, UnauthorizedError, SlowConsumerError,
PartitionUnavailableError, DerivedStreamError and HistoryRequiredError; other codes are
a plain RemoteError. RemoteError.retryable is true only for Overloaded, which the client
retries itself before raising RetriesExhaustedError. An ambiguous write is
AmbiguousWriteError.[18]
Query statuses (not errors)
These are carried in the status byte of QUERY_RESPONSE, of each QUERY_MULTI_RESPONSE
result and of STREAM_METADATA, not in an ERROR frame:
| Value | Name | Meaning |
|---|---|---|
0x00 |
OK | Answered. |
0x02 |
STREAM_NOT_FOUND | The node has never ingested this stream. |
0x03 |
INVALID_RANGE | end ≤ start, or a candle query starting before 0. |
0x04 |
ELSEWHERE | In QUERY_ only: another node serves this sub-query's stream; a redirect follows. |
The Go client returns a non-OK status as a QueryStatusError; Python raises
QueryStatusError (or its StreamNotFoundError subclass).
References
Source
wire.ErrorCodeconstants andErrorCode.StringServer.writeErrorRetryAfter,writeBadBatch,writeShed,tokenRefusal,handleSubscribeServer.fenced,placementChecked,stalePlacementRetryMillis,drainRetryAfterMillisServer.writeUnavailable,promotionRetryAfterMillisServer.handleQueryMultiwireclient.RemoteError,retryWait,RetryOptions,startableElsewhere,finalAnswerclient.ErrorCodeexportsbulkloadHistoryRequired handling
Tests
TestErrorCodeOverloaded_HasAMetricLabel,TestErrorFrame_RetryAfterRoundTrips,TestErrorFrame_LegacyZeroReservedParsesAsNoHint— /internal/wire/protocol_overload_test.goTestServer_ShedIngestAnswersOverloaded— /internal/network/server_overload_test.goTestServer_UnadmissibleBatchAnswersProtocolAndLogsCause— /internal/network/error_paths_test.goTestCorrection_ARefusalSaysWhyOnTheWire— /tests/history_backfill_durability_test.goTestServer_SlowSubscriberIsEvictedWithSlowConsumerError— /internal/network/subscription_eviction_test.goTestUnavailable_APartitionWithADownPrimaryIsRefusedNotRedirected,TestUnavailable_APrimaryStillReplayingItsLogRefusesRetryably— /internal/network/unavailable_test.goTestServer_AWriteToADerivedStreamIsRefusedWithoutOverwrite— /internal/network/derived_write_test.goTestServer_APlainWriteNoChunkOrCacheCanHoldIsAnsweredHistoryRequired— /internal/network/history_required_test.goTestServer_UnsupportedFrameAnswered— /internal/network/server_test.go;TestRedirect_AClientSendingOneIsStillRefused— /internal/network/redirect_test.goTestServer_EveryEnforcementSiteRefusesAnExcludedGrant— /internal/network/auth_enforcement_test.go;TestServer_ExpiredSessionRefusesNewWork— /internal/network/auth_expiry_test.go
Further reading
- Wire protocol, Permissions, Metrics
- Durability and acknowledgements, Writing data
- Failure detection, leases and failover, Moving partitions and rebalancing
- Troubleshooting
placementCheckedin /internal/network/fencing.go andredirectedin /internal/network/redirect.go run before any dispatcher call in every handler. ↩︎ErrorCode.Stringin /internal/wire/protocol.go;Server.writeErrorRetryAfterincrementsErrorsTotalwith("network", code.String());TestErrorCodeOverloaded_HasAMetricLabel. ↩︎ErrorCodeProtocolcall sites in /internal/network;writeBadBatchin /internal/network/server.go. ↩︎ParseCandleBatchPayloadrefuses on the first bad record; admission refusals (ingestion.ErrBadBatch) are raised before the WAL append. ↩︎Server.reportReadFailurein /internal/network/server.go. ↩︎Server.handleQueryMultiin /internal/network/multiquery.go. ↩︎tokenRefusal,sessionRefusal, and the permission checks in each handler, /internal/network/server.go;handleReauthin /internal/network/reauth.go. ↩︎finishIngestin /internal/network/server.go; the retry policy's reasoning in /internal/wireclient/retry.go. ↩︎The default branch of
serveFrames, andhandleSubscribe(partials,ErrTooManySubscriptions). ↩︎Server.writeSubscriptionEvicted;TestServer_SlowSubscriberIsEvictedWithSlowConsumerError. ↩︎ErrorCodeOverloadeddoc comment in /internal/wire/protocol.go;writeShedandclampRetryAfterMillisin /internal/network/server.go;drainRetryAfterMillis(100) in /internal/network/fencing.go;promotionRetryAfterMillis(250) in /internal/network/redirect.go. ↩︎Server.fencedin /internal/network/fencing.go. ↩︎Server.writeUnavailablein /internal/network/redirect.go;TestUnavailable_APartitionWithADownPrimaryIsRefusedNotRedirected. ↩︎Server.derivedRefusedin /internal/network/server.go. ↩︎writeBadBatchmaps aBatchRefusalwithNeedsHistoryto this code;TestServer_APlainWriteNoChunkOrCacheCanHoldIsAnsweredHistoryRequired. ↩︎RemoteError,RemoteError.Is,RemoteError.RetryAfterin /internal/wireclient/client.go; exports in /client/client.go. ↩︎RetryOptions.withDefaultsandretryWaitin /internal/wireclient/retry.go. ↩︎python-client/src/mirexa/errors.pyand_core.pyin the separate Python SDK repository, read 2026-10-30. ↩︎