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

Midnight node error codes

Midnight node errors are LedgerApiError codes mapped to u8 (0–255). They surface via Substrate's InvalidTransaction::Custom(u8) when the node rejects a transaction at the ledger level.

They often occur when the node rejects a submitted transaction with Custom(N) in the Substrate dispatch error.

info

A pallet-level DispatchError::Module surfaces with index 5 (pallet_midnight) or 6 (pallet_midnight_system) and you need to decode the inner error. To learn how to decode the inner error, see the Decode 1010 transaction rejection errors troubleshooting guide.

Error tables by code range

Below is a list of the Midnight node specific errors categorized by type and status code. The error tables group errors by code range to help you identify the error types.

Deserialization errors (0–11)

Errors that occur when the node fails to deserialize data from the wire format.

CodeNameDescriptionHow to fix
0NetworkIdFailed to deserialize the network IDCheck SDK version compatibility, verify network ID encoding
1TransactionFailed to deserialize transaction payloadVerify transaction was built with a compatible SDK version
2LedgerStateFailed to deserialize ledger stateInternal node error
3ContractAddressFailed to deserialize contract addressVerify the contract address format
4PublicKeyFailed to deserialize public keyCheck key format and encoding
5VersionedArenaKeyFailed to deserialize versioned arena keyInternal
6UserAddressFailed to deserialize user addressVerify address format
7TypedArenaKeyFailed to deserialize typed arena keyInternal
8SystemTransactionFailed to deserialize system transactionGovernance/bridge transaction format error
9DustPublicKeyFailed to deserialize DUST public keyCheck DUST key format
10CNightGeneratesDustActionTypeFailed to deserialize cNIGHT-generates-DUST action typeInternal bridge/observation error
11CNightGeneratesDustEventFailed to deserialize cNIGHT-generates-DUST eventInternal bridge/observation error

Most deserialization errors occur due to version mismatch. Always refer to the compatibility matrix to ensure you are using compatible versions of Midnight blockchain components.

Serialization errors (50–63)

Errors that occur when the node fails to serialize data for storage or transmission.

CodeNameDescriptionHow to fix
50TransactionIdentifierFailed to serialize transaction identifierInternal
51LedgerStateFailed to serialize ledger stateInternal node error
52LedgerParametersFailed to serialize ledger parametersInternal node error
53ContractAddressFailed to serialize contract addressInternal
54ContractStateFailed to serialize contract stateThe contract state might be corrupt
55ContractStateToJsonFailed to serialize contract state to JSONContract state format incompatible with JSON serialization
56ZswapStateFailed to serialize Zswap stateInternal Zswap error
57UnknownTypeFailed to serialize an unknown typeInternal
58MerkleTreeDigestFailed to serialize Merkle tree digestInternal Merkle tree error
59VersionedArenaKeyFailed to serialize versioned arena keyInternal
60TypedArenaKeyFailed to serialize typed arena keyInternal
61CNightGeneratesDustEventFailed to serialize cNIGHT-generates-DUST eventInternal bridge error
62SystemTransactionFailed to serialize system transactionInternal governance error
63ArenaHashFailed to serialize arena hashInternal

Transaction invalid (100–109, 193–200)

Errors that occur when the node applies a transaction to the ledger state and then rejects it for violating a ledger invariant.

CodeNameDescriptionHow to fix
100EffectsMismatchDeclared transaction effects don't match the computed effectsRebuild the transaction. The effects declaration is stale or the SDK computed it incorrectly
101ContractAlreadyDeployedA contract already exists at the target addressUse a different contract address or find the existing deployment
102ContractNotPresentCalled a contract that doesn't exist at the given addressVerify the contract address; deploy the contract first
103ZswapZswap-level transaction error (e.g., double-spend, unknown Merkle root)Check for nullifier reuse, verify coin tree root is current
104TranscriptThe node rejected on-chain transcript executionCheck contract logic; the circuit's on-chain transcript failed
105InsufficientClaimableNot enough NIGHT tokens to claimEnsure sufficient NIGHT balance for the operation
106VerifierKeyNotFoundVerifier key missing for the circuit operationDeploy the verifier key before calling the circuit
107VerifierKeyAlreadyPresentVerifier key already exists for this operationThe key is already deployed; no action needed
108ReplayCounterMismatchSigned counter doesn't match (replay attack prevention)Rebuild the transaction with the current replay counter
109UnknownErrorUnclassified transaction invalid errorCheck node logs for details
193ReplayProtectionViolationTransaction violates replay protection (duplicate intent)This transaction or intent was already submitted
194BalanceCheckOutOfBoundsToken balance would overflow or underflowVerify token amounts don't exceed representable range
195InputNotInUtxosInput references a UTXO that doesn't exist in the setThe coin may already be spent; resync wallet state
196DustDoubleSpendAttempt to spend the same DUST twiceDUST UTXO already consumed; resync DUST wallet
197DustDeregistrationNotRegisteredAttempting to deregister a DUST address that isn't registeredVerify the DUST address is currently registered
198GenerationInfoAlreadyPresentDUST generation info already existsDuplicate generation info submission
199InvariantViolationProtocol-level invariant violated (e.g., NIGHT supply exceeded)Transaction would break fundamental protocol rules
200RewardTooSmallClaimed reward is below the minimum payout thresholdAccumulate more rewards before claiming

Transaction malformed (110–139, 166–192)

Errors that occur when the node rejects a transaction that is structurally invalid.

CodeNameDescriptionHow to fix
110VerifierKeyNotSetContract deployed without required verifier keyInclude verifier keys when deploying the contract
111TransactionTooLargeTransaction exceeds maximum allowed sizeReduce transaction payload; split into multiple transactions
112VerifierKeyTooLargeVerifier key exceeds deserialization limitUse a smaller circuit or contact Midnight support
113VerifierKeyNotPresentReferenced verifier key not foundDeploy the contract with the verifier key before calling the circuit
114ContractNotPresentTransaction references a non-existent contractVerify contract address; deploy the contract first
115InvalidProofZero-knowledge proof verification failedRegenerate the proof. Ensure the proof server is compatible
116BindingCommitmentOpeningInvalidBinding commitment was incorrectly openedInternal Zswap error — rebuild the transaction
117NotNormalizedTransaction is not in normal formRebuild with the SDK; normalize the transaction before submission
118FallibleWithoutCheckpointFallible transcript missing initial checkpointAdd kernel.checkpoint() at the start of fallible sections
119ClaimReceiveFailedFailed to claim a coin commitment receiveCoin commitment format error; rebuild the transaction
120ClaimSpendFailedFailed to claim a coin commitment spendCoin commitment format error; rebuild the transaction
121ClaimNullifierFailedFailed to claim a nullifierNullifier format error; rebuild the transaction
122ClaimCallFailedFailed to claim a contract callContract call format error; rebuild the transaction
123InvalidSchnorrProofFiat-Shamir Schnorr proof verification failedSigning error — regenerate the transaction signature
124UnclaimedCoinComContract-owned output left unclaimedEnsure you claim all contract outputs in the transaction before submitting the transaction
125UnclaimedNullifierContract-owned coin input left unauthorizedYou must authorize all contract inputs
126UnbalancedNegative balance in a token typeTransaction doesn't balance. Check token amounts
127ZswapZswap offer is structurally malformedRebuild the Zswap offer and check proof validity
128BuiltinDecodeFAB (field-aligned binary) decode errorInternal encoding error. Verify data formats
129GuaranteedLimitExceeded guaranteed section limitsReduce the guaranteed section size
130MergingContractsError merging contract intentsThese contracts cannot merge; check configuration
131CantMergeTypesAttempted to merge incompatible transaction typesTransaction types must be compatible for merging
132ClaimOverflowClaimed coin value overflows deltasToken amounts exceed representable range
133ClaimCoinMismatchClaimRewards coin doesn't match the real coinRebuild the claim with correct coin data
134KeyNotInCommitteeSigning key is not a committee memberOnly committee members can sign this operation
135InvalidCommitteeSignatureCommittee signature verification failedVerify the signing key and signature
136ThresholdMissedCommittee approval threshold not metGather more committee signatures
137TooManyZswapEntriesToo many Zswap entries (>=2^16)Reduce the number of shielded operations
138BalanceCheckOverspendNegative balance in a transaction segmentSegment spends more than available; check amounts
139UnknownErrorUnclassified malformed transaction errorCheck node logs for details
166InvalidNetworkIdTransaction's network ID doesn't match the node's networkVerify networkId matches the target (for example, undeployed for devnet); check setNetworkId()
167IllegallyDeclaredGuaranteedGuaranteed segment (0) used where forbiddenDon't use segment_id 0 for intents
168FeeCalculationFee calculation errorTransaction size or timing parameters are invalid
169InvalidDustRegistrationSignatureDUST registration signature verification failedRegenerate DUST registration with correct keys
170InvalidDustSpendProofDUST spend proof verification failedRegenerate DUST spend proof
171OutOfDustValidityWindowDUST outside its validity time windowDUST creation time is outside the allowed window; use fresher DUST
172MultipleDustRegistrationsForKeyMultiple DUST registrations for same key in one intentOnly one DUST registration per key per intent
173InsufficientDustForRegistrationFeeNot enough DUST to pay registration feeAcquire more DUST before registering
174MalformedContractDeployContract deployment is structurally invalidCheck for non-zero balance or incorrect charged state in deploy
175IntentSignatureVerificationFailureIntent signature verification failedRegenerate intent signatures
176IntentSignatureKeyMismatchSigning key doesn't match verifying keyUse the correct signing key for the intent
177IntentSegmentIdCollisionDuplicate segment_id in intent mergeEach intent must have a unique segment_id
178IntentAtGuaranteedSegmentIdIntent placed at segment_id 0 (reserved for guaranteed)Use segment_id >= 1 for intents
179UnsupportedProofVersionProof version not supportedUpdate SDK/proof server to a compatible version
180GuaranteedTranscriptVersionGuaranteed transcript version not supportedUpdate to a compatible ledger/SDK version
181FallibleTranscriptVersionFallible transcript version not supportedUpdate to a compatible ledger/SDK version
182TransactionApplicationErrorIntent TTL expired, too far in future, or duplicateCheck intent timing; avoid resubmitting same intent
183BalanceCheckOutOfBoundsBalance overflow/underflow in a segmentToken amounts in a segment exceed representable range
184BalanceCheckConversionFailureFailed to convert balance to i128Token amount too large for internal representation
185PedersenCheckFailureBinding commitment mismatchInternal cryptographic error — rebuild the transaction
186EffectsCheckFailureTransaction effects validation failedDeclared effects don't match computed effects
187DisjointCheckFailureInput/output sets are not disjointShielded and transient inputs/outputs must not overlap
188SequencingCheckFailureCall graph sequencing violatedContract calls must respect ordering constraints
189InputsNotSortedUnshielded inputs are not sortedSort unshielded inputs before submission
190OutputsNotSortedUnshielded outputs are not sortedSort unshielded outputs before submission
191DuplicateInputsDuplicate unshielded inputsRemove duplicate inputs from the transaction
192InputsSignaturesLengthMismatchInput count doesn't match signature countEnsure each input has a corresponding signature

Infrastructure errors (150–155, 165)

Errors that occur when the node encounters infrastructure errors not directly related to transaction content.

CodeNameDescriptionHow to fix
150LedgerCacheErrorLedger cache mutex/lock poisonedRestart the node; this is an internal concurrency error
151NoLedgerStateNo ledger state present in the nodeNode may not be fully synced; wait for sync to complete
152LedgerStateScaleDecodingErrorSCALE decoding of ledger state failedThe node state might be corrupt; try a resync
153ContractCallCostErrorFailed to calculate contract call costInternal cost model error
154BlockLimitExceededErrorTransaction exceeds block limitsReduce transaction size or wait for a less congested block
155FeeCalculationErrorFee calculation failedInternal fee model error
165GetTransactionContextErrorFailed to retrieve transaction contextInternal node error

System transaction errors (201–210)

Errors that occur when the node encounters errors from governance and bridge system transactions. These are special transactions submitted by the network's governance mechanisms.

CodeNameDescriptionHow to fix
201IllegalPayoutPayout exceeds remaining supply or bridge poolPayout amount is too large for available funds
202InsufficientTreasuryFundsTreasury doesn't have enough fundsRequested amount exceeds treasury balance
203CommitmentAlreadyPresentFaerie-gold double-commitment attemptCommitment already exists in the tree
204UnknownErrorUnclassified system transaction errorCheck node logs
205ReplayProtectionFailureSystem transaction replay protection violatedDuplicate system transaction
206IllegalReserveDistributionReserve distribution exceeds supplyDistribution amount exceeds available reserves
207GenerationInfoAlreadyPresentDUST generation info already insertedDuplicate generation info
208InvalidBasisPointsBridge fee basis points >= 10,000Basis points must be between 0 and 9,999
209InvariantViolationProtocol-level invariant violatedTransaction would break fundamental protocol rules
210TreasuryDisabledAttempted to access disabled treasuryTreasury feature is not enabled

Host API error (255)

Errors that occur when the node encounters errors from the host API.

CodeNameDescriptionHow to fix
255HostApiErrorError in host API processingInternal runtime error; check node logs

Pallet dispatch errors

When a transaction fails inside a Substrate pallet, the error surfaces as DispatchError::Module { index, error }. The index identifies the pallet and error is the SCALE-encoded variant index within that pallet's error enum.

Below is a list of the Midnight node specific pallet errors categorized by pallet and variant.

Pallet index map

Below is a list of the Midnight node specific pallet indices and their descriptions.

IndexPalletDescription
5pallet_midnightCore Midnight ledger pallet
6pallet_midnight_systemSystem transaction pallet
13pallet_cnight_observationcNIGHT bridge observation
44pallet_federated_authorityGovernance authority
45pallet_federated_authority_observationAuthority observation
50pallet_system_parametersSystem parameters
51pallet_throttleTransaction throttling

pallet_midnight

Errors from the core pallet managing the ledger state and transactions.

VariantNameDescription
0NewStateOutOfBoundsNew ledger state is out of acceptable bounds
1DeserializationWraps DeserializationError (codes 0–11)
2SerializationWraps SerializationError (codes 50–63)
3TransactionWraps TransactionError (codes 100–210)
4LedgerCacheErrorLedger cache poisoned (code 150)
5NoLedgerStateNo ledger state (code 151)
6LedgerStateScaleDecodingErrorSCALE decode failure (code 152)
7ContractCallCostErrorCost calculation failure (code 153)
8BlockLimitExceededErrorBlock limit exceeded (code 154)
9FeeCalculationErrorFee calculation failure (code 155)
10HostApiErrorHost API error (code 255)
11NetworkIdNotStringNetwork ID not a valid string
12GetTransactionContextErrorTransaction context retrieval error (code 165)

pallet_midnight_system

Errors from the system transaction pallet.

VariantNameDescription
0LedgerApiErrorWraps full LedgerApiError
1SystemTransactionNotAllowedForGovernanceGovernance-disallowed system transaction

pallet_federated_authority

Errors from the multi-collective governance authority pallet.

VariantNameDescription
0MotionAlreadyApprovedAuthority already approved this motion
1MotionApprovalMissingApprover not in the approval list
2MotionApprovalExceedsBoundsExceeds maximum authority bodies
3MotionNotFoundMotion does not exist
4MotionNotEndedMotion voting not yet complete
5MotionHasEndedMotion ended; no more changes allowed
6MotionTooEarlyToCloseApproval period hasn't ended yet
7MotionAlreadyExistsMotion already exists
8MotionExpiredMotion expired without enough approvals
9MotionWeightBoundTooLowWeight bound too low for the call

pallet_cnight_observation

Errors from the cNIGHT bridge integration pallet.

VariantNameDescription
0MaxCardanoAddrLengthExceededCardano wallet address too long
1MaxRegistrationsExceededToo many registrations
2LedgerApiErrorWraps LedgerApiError
3InherentAlreadyExecutedOnly one inherent call per block
4CardanoPositionRegressionNext Cardano position doesn't advance
5TooManyUtxosUTXO count exceeds capacity

pallet_federated_authority_observation

Errors from the multi-collective governance synchronization pallet.

VariantNameDescription
0EmptyMembersMembership set is empty
1DuplicatedMembersDuplicate members in the set
2InherentAlreadyExecutedOnly one inherent call per block

pallet_system_parameters

Errors from the system parameters pallet.

VariantNameDescription
0UrlTooLongURL exceeds maximum allowed length

JSON-RPC error codes

The Midnight node uses standard JSON-RPC 2.0 error codes from the jsonrpsee crate. These are the most common error codes you might encounter when interacting with the node.

CodeNameUsed inDescription
-32602INVALID_PARAMSState RPC, Block RPC, Events, Peer InfoBad contract address, account address, block hash, peer ID, or other invalid parameter
-32603INTERNAL_ERRORPeer Info RPC, System Parameters RPCFailed to send/receive internal requests, runtime API failures