Skip to main content
For the complete documentation index, see llms.txt

Midnight indexer error codes

The Midnight indexer is a Rust service built on Axum that serves a GraphQL API via async-graphql, typically on port 8088. All errors use thiserror derives.

Errors fall into two categories:

  • Client errors: Appear verbatim in GraphQL error responses and indicate invalid caller input.
  • Server errors: Logged internally by the indexer. Callers receive a generic "Internal Server Error" message.

You encounter these errors when:

  • The node rejects a GraphQL query or mutation due to invalid input
  • The /ready health endpoint returns non-200 during startup or when the indexer lags behind the node
  • Infrastructure failures occur (database, messaging, cipher)

HTTP status codes

The Axum HTTP layer returns these codes before any GraphQL processing occurs.

CodeEndpoint / contextDescriptionFix
200 OKGET /readyIndexer is caught up with the node.Service is healthy.
400 Bad RequestGraphQL bodyInvalid request body (malformed JSON or missing required fields).Check GraphQL query syntax and ensure Content-Type: application/json is set.
413 Payload Too LargeGraphQL bodyRequest body exceeds the configured size limit.Reduce query complexity, paginate results, or split into multiple smaller queries.
503 Service UnavailableGET /readyIndexer has not caught up with the node.Wait for the indexer to finish syncing, check node connectivity, and indexer logs.

GraphQL client error messages

These strings appear verbatim in GraphQL error responses (errors[].message). They indicate invalid input from the caller.

Block errors

These errors occur when the indexer cannot resolve a block reference in a query.

MessageDescriptionFix
"block with hash {hash} not found"No block with the given hash exists in the indexed chain.The block might not be final yet, or the hash is incorrect; verify the hash and try again.
"block with height {height} not found"The indexer has not yet indexed a block at that height.The indexer might not have reached that height yet; check sync status via GET /ready.
"invalid block hash"The supplied block hash is not valid hex or has the wrong length.Verify the block hash format; it must be a valid 32-byte hex-encoded string.

Viewing key and session errors

These errors occur when wallet credentials or session tokens fail validation.

MessageDescriptionFix
"invalid session ID"The session ID has an invalid format (not a valid UUID).Use the session ID exactly as returned during session creation.
"invalid viewing key"The supplied viewing key failed to decode or validate.Ensure a compatible SDK version generated the viewing key and that it is correctly encoded.
"unknown or expired session ID"The session ID does not exist or has timed out.Re-authenticate to obtain a fresh session ID.

Transaction errors

These errors occur when a transaction reference or identifier supplied in a query is invalid.

MessageDescriptionFix
"invalid transaction hash"The transaction hash is not a valid hex-encoded hash.Verify the hash format; it must be a valid 32-byte hex string.
"invalid transaction identifier"The transaction identifier failed validation.Check the identifier format; it may be base58 or hex depending on context.

Address errors

These errors occur when an address supplied in a query fails format or checksum validation.

MessageDescriptionFix
"invalid address"The supplied address (unshielded, shielded, or DUST) failed Bech32m decode or HRP validation.Verify the address format. For expected HRP prefixes, see the Address format errors section.
"invalid Cardano reward address"The Cardano stake address failed validation.Use a valid Bech32-encoded Cardano stake address with HRP stake for Mainnet or stake_test for Testnet and ensure it is 29 bytes.
"invalid hex-encoded DUST address"The DUST address hex encoding is invalid.Supply a correctly hex-encoded DUST address.
"invalid hex-encoded nullifier prefix"The nullifier prefix is not valid hex.Supply a correctly hex-encoded nullifier prefix.

Pagination and identifier errors

These errors occur when pagination parameters or generic identifiers fail validation.

MessageDescriptionFix
"invalid identifier"A generic identifier (for example, contract address or key) failed validation.Verify the format of the identifier you are passing.
"invalid offset"The pagination offset value is not a valid non-negative integer.Use a non-negative integer for the offset parameter.
"maximum of ten reward addresses allowed"You supplied more than 10 Cardano reward addresses in a single query.Split the request into batches of 10 or fewer addresses.

Domain errors

Domain errors arise from validation of structured values such as network IDs and protocol versions.

InvalidNetworkIdError

Returned when a network ID value fails validation.

VariantDescriptionFix
EmptyNetwork ID must not be emptyProvide a non-empty network ID string.
NotLowercaseNetwork ID must be all lowercaseConvert the network ID to lowercase before use.

ProtocolVersionError

Returned when the system cannot resolve a protocol version value to a known version.

VariantDescriptionFix
ScaleDecodeSCALE decoding of the protocol version failed.The raw bytes are invalid; this typically indicates a node/indexer version mismatch.
TryFromI64The system cannot convert the version value from i64.The raw version value is negative or out of i64 representable range; internal error.
Unsupported(u32)Protocol version number is not in a recognized range.Valid ranges: 22000-23000 (maps to V0_22), 1000000-1001000 (maps to V1_0); update the indexer if a newer version is available.

ledger::Error

Internal ledger errors (13 variants). These are server errors. Callers see only "Internal Server Error". Check indexer logs for details.

VariantDescription
BackwardsLedgerStateTranslationLedger state translation went backwards (version regression).
BlockLimitExceededOperation exceeds block-level limits.
ByteArrayLenByte array has unexpected length.
DeserializeFailed to deserialize ledger data.
FromUtf8Failed to convert bytes to UTF-8 string.
GetContractStateFailed to retrieve contract state.
InvalidUpdateThe node rejected the ledger state update as invalid.
LedgerStateTranslationGeneric ledger state translation failure.
LoadLedgerStateFailed to load ledger state from storage.
MalformedTransactionTransaction data is structurally malformed.
SerializeFailed to serialize ledger data.
SystemTransactionError processing a system transaction.
TransactionCostFailed to calculate transaction cost.
UnsupportedLedgerStateTranslationNo translation path available for this ledger state version.

Address format errors

These errors surface when a Midnight or Cardano address supplied to the indexer fails to decode.

DecodeAddressError

Returned when a Midnight address fails to decode.

VariantDescriptionFix
DecodeBech32m decode failed (invalid characters, bad checksum, or truncated).Ensure the address is a valid Bech32m string.
InvalidHrpHuman-readable part (HRP) does not match the expected prefix.Use the correct address type for the operation; see expected HRP prefixes below.

Expected HRP prefixes:

Address typeMainnet HRPNon-Mainnet HRP
Unshieldedmn_addrmn_addr_{network_id}
Encryption key (shielded)mn_shield-eskmn_shield-esk_{network_id}
DUSTmn_dustmn_dust_{network_id}

DecodeCardanoRewardAddressError

Returned when a Cardano stake (reward) address fails to decode.

VariantDescriptionFix
DecodeBech32 decode failed.Ensure the address is a valid Bech32-encoded Cardano stake address.
InvalidHrpHRP is not stake or stake_test.Use a Cardano Mainnet (stake) or Testnet (stake_test) reward address.
InvalidLengthDecoded bytes are not 29 bytes.The address payload must be exactly 29 bytes; verify the address is not truncated or padded.
WrongNetworkAddress network byte does not match the expected network.Ensure the Cardano address is for the correct network (Mainnet vs. Testnet).

Chain indexer errors (SubxtNodeError)

These errors arise from the streaming layer that connects the indexer to the Midnight node via Subxt. Most variants trigger automatic reconnection; persistent errors indicate node connectivity or compatibility issues.

There are 22 variants in total. The following table lists the most common ones.

VariantDescriptionAction
GenesisLedgerStateNotFoundNo genesis ledger state found in system parameters.Node system parameters storage is missing genesis data; might indicate a misconfigured or corrupted node.
GetContractStateThe indexer cannot fetch contract state from the node.Node RPC failure; check node logs and connectivity.
ProtocolVersionThe indexer encountered an unsupported protocol version during sync.The indexer does not recognize this protocol version; upgrade the indexer.
ReceiveBlockNode disconnected mid-stream.The indexer auto-reconnects. If persistent, check node stability.
ScaleDecodeSCALE decode failure when processing a block or event.The indexer could not decode data from the node; likely a version mismatch.
SubscribeFinalizedBlocksThe indexer cannot subscribe to the finalized block stream from the node.Verify the node's WebSocket endpoint is reachable; check node logs.

Infrastructure errors

These are server errors. The indexer logs them internally and returns "Internal Server Error" to callers. Investigate via indexer logs.

Database

Database errors occur when the indexer cannot connect to or query its storage backend.

CategoryExamplesCommon causes
PostgresPoolConnection pool exhaustion, failed to acquire connection.PostgreSQL unreachable, connection limit exceeded, or credentials wrong.
SqlitePoolSQLite pool failure.SQLite file locked, disk full, or permissions issue.
Migration errorsSchema migration failed on startup.Database schema out of date or incompatible; run pending migrations.

Messaging (NATS)

Messaging errors occur when the indexer cannot publish or receive events through the NATS message broker.

CategoryDescriptionCommon causes
NATS publisher errorsFailed to publish a message to NATS.NATS server unreachable or subject permissions denied.
NATS subscriber errorsFailed to subscribe to or receive from a NATS subject.NATS server connectivity issue or subject not found.

Cipher

Cipher errors occur when the indexer cannot initialize its encryption key from configuration.

VariantDescriptionFix
Hex decode failureCipher key or encrypted value is not valid hex.Verify the cipher key configuration is correctly hex-encoded.
Key too shortCipher key is below the minimum required length.Provide a key of at least 32 bytes (64 hex characters).