Skip to main content

Error codes

Every error the server returns is an ErrorResponse with a stable numeric code. Match on the code, never on the text. The error_message is a JSON object with the error's context, for example {"expected_version":4,"current_aggregate_version":6} on a concurrency conflict or {"leader_address":"10.0.0.2:10000"} on a not-leader.

Names below are the server constants in celeriant_msg/src/error_codes.rs. The .NET client exposes the same codes as ErrorResponse constants in PascalCase (WriteNotLeader), and the Rust client maps them to ServerError variants. Codes are sparse; gaps are unused.

Pre-1.0

Codes can still change before 1.0.

Read (1xxx)

CodeNameMeaning
1000READ_UNAVAILABLE_VERSIONThe requested version is below the first one still stored, usually because the stream was trimmed. The message carries requested and minimum_available.
1001READ_AGGREGATE_NOT_EXISTSNo such aggregate.
1002READ_CACHE_LOAD_LOCK_TIMEOUTLoading the aggregate into cache timed out waiting on another loader. Retry.
1003READ_CACHE_LOAD_FILE_SCANDisk scan failed while loading the aggregate into cache.
1004READ_FETCH_DATABLOCKSFailed to fetch data blocks from disk.
1005READ_FETCH_METABLOCKSFailed to fetch metadata blocks from disk.

Write (2000-2013)

CodeNameMeaning
2000WRITE_EMPTY_EVENTS_LISTOne of the aggregates in the write has no events.
2001WRITE_ZERO_EVENT_TYPEAn event has event_type_major 0, which is reserved.
2002WRITE_CLIENT_IDEMPOTENCY_VIOLATIONWith idempotency enforced, the write's lowest client sequence is at or below the last committed sequence for this client on this aggregate. It proves the sequence is consumed for this (aggregate, client_id), not that your event consumed it: concurrent writers sharing a client id can take each other's sequences. Verify by point-reading the sequence. See what a 2002 proves and the idempotency guide.
2003WRITE_OPTIMISTIC_CONCURRENCY_VIOLATIONexpected_version does not match the aggregate's current version. Re-read and retry. See Optimistic concurrency.
2004WRITE_FAILED_TO_SERIALISE_DATABLOCKSThe server could not serialise the write's events.
2005WRITE_AGGREGATE_NOT_EXISTSThe aggregate does not exist and the write did not set allow_create.
2006WRITE_AGGREGATE_RECREATE_NOT_ALLOWEDThe aggregate was deleted without allow_recreate.
2007WRITE_REPLICATION_ERRORReplicating the write to the follower failed.
2008WRITE_FSYNC_ERRORThe leader's fsync failed.
2009WRITE_CACHE_AGGREGATE_CLIENT_ERRORInternal cache error loading the client's sequence state or the schema cache.
2010WRITE_AGGREGATE_EXISTS_CACHE_ERRORInternal cache error checking whether the aggregate exists.
2011WRITE_NOT_LEADERThe write hit a follower. The message carries leader_address when known. Client pools redirect automatically. See two-node cluster.
2012WRITE_REPLICATION_BACKPRESSUREThe leader is shedding writes because replication is behind or just rolled back. Back off and retry. See troubleshooting.
2013WRITE_INFLIGHT_DUPLICATESame check as 2002, but the earlier write with that sequence is still in flight: queued, or fsynced and not yet committed. It is not durable yet and can still roll back, so this is not success. Hold the sequence, back off, retry. It resolves to a clean write or a 2002.

With idempotency enforced, the expected-version check runs before the sequence check. A retry of a write that already landed with expected_version set gets 2003, not 2002.

Schema (2020-2029)

CodeNameMeaning
2020REGISTER_SCHEMA_ALREADY_EXISTSA schema is already registered, or pending, for this org, aggregate type and event type major/minor.
2021REGISTER_SCHEMA_INVALIDThe schema did not parse or compile, or exceeds --max-schema-size-bytes.
2022WRITE_SCHEMA_VALIDATION_FAILEDAn event failed validation against its registered schema. The message names the event type and client sequence.
2023WRITE_SCHEMA_COMPILATION_FAILEDThe registered schema for this event type failed to compile when loaded, so writes of that type cannot be validated. Registering it again gets 2020.
2024REGISTER_SCHEMA_UNSUPPORTED_TYPEschema_type is not 0 (JSON), 1 (Avro) or 2 (Protobuf).
2025REGISTER_SCHEMA_CACHE_LOAD_ERRORInternal cache load failure for the schema registry.
2026REGISTER_SCHEMA_FSYNC_ERRORFsync failed writing the schema.
2027REGISTER_SCHEMA_CANNOT_ACCEPT_WRITESThis node is not the leader. Treated as not-leader; client pools redirect.
2028REGISTER_SCHEMA_REPLICATION_ERRORReplicating the registration to the follower failed.
2029REGISTER_SCHEMA_COORDINATION_FAILEDShard 0 registered the schema, then the fan-out to the other shards failed or timed out. The message carries failed_shard_count and total_shards. Not transient: shard 0 already holds the schema, so a plain retry gets 2020 and never repairs the shards that missed it.

Trim (3xxx)

CodeNameMeaning
3000TRIM_AGGREGATE_NOT_EXISTSNo such aggregate.
3001TRIM_CACHE_ERRORInternal cache error.
3002TRIM_REPLICATION_ERRORReplicating the trim failed.
3003TRIM_FSYNC_ERRORFsync failed.
3004TRIM_INDEX_OUT_OF_RANGEkeep_from_aggregate_version is past the aggregate's current version.
3005TRIM_NOT_LEADERThe trim hit a follower. Client pools redirect.
3006TRIM_REPLICATION_BACKPRESSUREThe leader is shedding load. Back off and retry.

Delete (4xxx)

CodeNameMeaning
4000DELETE_AGGREGATE_NOT_EXISTSNo such aggregate.
4001DELETE_EMPTY_DELETE_LISTThe delete named no aggregates. The router rejects that first with 9002, so a client should not see 4001.
4002DELETE_OPTIMISTIC_CONCURRENCY_VIOLATIONexpected_version does not match. Re-read and retry.
4003DELETE_CACHE_ERRORInternal cache error.
4004DELETE_REPLICATION_ERRORReplicating the delete failed.
4005DELETE_FSYNC_ERRORFsync failed.
4006DELETE_NOT_LEADERThe delete hit a follower. Client pools redirect.
4007DELETE_REPLICATION_BACKPRESSUREThe leader is shedding load. Back off and retry.

Listing (5xxx)

CodeNameMeaning
5000LIST_ORGS_DISK_READListing orgs failed reading the WAL.
5001LIST_AGGREGATE_TYPES_DISK_READListing aggregate types failed reading the WAL.
5002LIST_AGGREGATES_DISK_READListing aggregates failed reading the WAL.

Replication batch (6xxx)

Sent on the replication port, from follower to leader. Clients never see these.

CodeNameMeaning
6000REPLICATION_BATCH_FSYNCThe follower's fsync of the batch failed.
6001REPLICATION_BATCH_SERIALISE_DATABLOCKSThe follower could not re-serialise the leader's data blocks.
6002REPLICATION_BATCH_WAL_SEQ_GAPThe batch's WAL sequences are not contiguous with the follower's log.

Aggregate details (7xxx)

CodeNameMeaning
7000EXISTS_CACHE_ERRORInternal cache error.
7001EXISTS_AGGREGATE_NOT_EXISTSThe aggregate does not exist.
7002EXISTS_METABLOCK_READ_ERRORFailed to read the aggregate's metadata blocks.

Watch (8xxx)

CodeNameMeaning
8000WATCH_REQUEST_INVALIDA watch request reached the shard's ordinary request path. An internal routing fault, not a problem with your filters.
8001WATCH_LATENCY_TOO_HIGHrequested_latency_ms exceeds --max-requested-latency-ms. The message carries requested_ms and max_ms.
8002WATCH_READ_IOI/O error reading events for a notification.
8003WATCH_READ_SERIALIZATIONSerialisation error building a notification.
8004WATCH_READ_OTHEROther internal error in the watch session.
8005WATCH_TOO_MANY_SUBSCRIBERSThe shard is at its --max-watch-subscribers cap. The message carries active_subscribers and max_subscribers.

Shard routing (9xxx)

CodeNameMeaning
9000SHARD_ROUTING_NO_KEYNo routing key. The router checks for empty filters first and returns 9002, so this is defensive.
9001SHARD_ROUTING_MULTIPLE_SHARDSThe write or delete keys, or the watch filter values, route to more than one shard (placement is id % num_shards). Nothing is split across shards. See Atomic multi-aggregate writes.
9002SHARD_ROUTING_INCOMPATIBLE_FILTERSThe request cannot be routed: an empty write or delete, a shard_id at or past the shard count, or a watch without a filter on the routing dimension (e.g. no orgs when routing by org_id). The message says which.

Identity and authentication (10xxx)

From the identify handshake. See Identity and authentication.

CodeNameMeaning
10001IDENTIFY_INVALID_NONCEThe nonce is unparsable, more than 2 minutes old, or more than 60 s in the future. Check the client clock.
10002IDENTIFY_INVALID_SIGNATUREThe signature did not verify against the public key.
10003IDENTIFY_MISMATCHA write, trim, delete or register-schema carries a client_id different from the one the connection proved with its RSA key.
10004IDENTIFY_REQUIREDThe server runs with --require-client-identity and the first message was not Identify. The connection closes.
10005AUTH_REQUIREDThe server has API keys configured and the Identify carried none.
10006AUTH_INVALID_KEYThe API key is not valid base64, not 32 bytes, or matches no stored hash.
10007AUTH_INSUFFICIENT_PERMISSIONSA read-only API key attempted a write, trim, delete or register-schema.

Server health (11xxx)

CodeNameMeaning
11000SERVER_BUSYThe channel to the owning shard is full (--mesh-channel-size), so the request was not handed over. Back off and retry. Persistent 11000s mean an overloaded shard.