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

Wallet SDK error reference

All errors in the Midnight wallet SDK are Effect Data.TaggedError instances unless noted otherwise.

To catch errors, use Effect.catchTag with the _tag field shown for each error. For union types, use Effect.catchTags.

This reference highlights the error classes with details on how to catch and fix them.

Node client (@midnight-ntwrk/wallet-sdk-node-client)

These seven errors form the NodeClientError union type.

SubmissionError

An error indicating that transaction submission to the node failed.

FieldValue
_tag'SubmissionError'
Fieldsmessage: string, txData: unknown, cause?: unknown

Fix: Inspect message and cause for the underlying reason. Check node connectivity and that the transaction format is correct.

Effect.catchTag('SubmissionError', (e) => ...)

ConnectionError

An error indicating a failed node connection through a WebSocket.

FieldValue
_tag'ConnectionError'

Known messages:

  • "Could not connect within specified time range (5s)": Node is unreachable or slow to respond
  • "Failed to retrieve genesis transactions": Connected but genesis data unavailable

Fix: Verify the node WebSocket URL is correct and the node is running. Increase connection timeout if the node is on a slow network.

Effect.catchTag('ConnectionError', (e) => ...)

TransactionProgressError

An error indicating that a submitted transaction did not reach the desired lifecycle stage within the expected time.

FieldValue
_tag'TransactionProgressError'

Known messages: "Transaction did not reach finality within expected time"

Fix: Check network congestion and node health. The transaction may still be in the mempool — query its status before resubmitting.

Effect.catchTag('TransactionProgressError', (e) => ...)

ParseError

An error indicating that the SDK could not parse a result returned by the node.

FieldValue
_tag'ParseError'

Fix: Usually indicates a protocol version mismatch between the SDK and the node. Check that SDK and node versions are compatible.

Effect.catchTag('ParseError', (e) => ...)

TransactionUsurpedError

An error indicating that another transaction replaced a transaction with the same discriminators.

FieldValue
_tag'TransactionUsurpedError'

Fix: The original transaction is no longer relevant. If an unexpected replacement occurred, then investigate which process submitted a conflicting transaction.

Effect.catchTag('TransactionUsurpedError', (e) => ...)

TransactionDroppedError

An error indicating that the node dropped a transaction, most likely because the mempool is full.

FieldValue
_tag'TransactionDroppedError'

Fix: Wait for the mempool to drain and resubmit. Consider increasing the transaction fee if the network supports fee prioritization.

Effect.catchTag('TransactionDroppedError', (e) => ...)

TransactionInvalidError

An error indicating that the node rejected a transaction as invalid.

FieldValue
_tag'TransactionInvalidError'

Fix: A malformed transaction or a validation-rule violation caused this error. Review the transaction construction logic. Do not resubmit without changes.

Effect.catchTag('TransactionInvalidError', (e) => ...)

Shielded wallet (@midnight-ntwrk/wallet-sdk-shielded)

The shielded wallet exposes 8 error types:

OtherWalletError

Catch-all for wallet errors that do not fit a more specific category.

FieldValue
_tag'Wallet.Other'

Fix: Inspect the error details. If this surfaces in production, then consider opening an issue with a reproduction case.

Effect.catchTag('Wallet.Other', (e) => ...)

SyncWalletError

An error indicating that a wallet sync with the Midnight blockchain failed.

FieldValue
_tag'Wallet.Sync'

Fix: Check connectivity to the node. Retry the sync operation. Persistent failures may indicate a corrupted local state.

Effect.catchTag('Wallet.Sync', (e) => ...)

SubmissionWalletError

A wrapper around submission errors that occur at the wallet layer (distinct from the node-client SubmissionError).

FieldValue
_tag'Wallet.SubmissionWalletError'

Fix: Unwrap and inspect the underlying cause. Usually delegates to the node-client submission path.

Effect.catchTag('Wallet.SubmissionWalletError', (e) => ...)

InsufficientFundsError

An error indicating that the wallet does not hold enough tokens of the specified type to complete the operation.

FieldValue
_tag'Wallet.InsufficientFunds'
FieldstokenType: string, amount: bigint

Fix: Check the wallet balance for tokenType before constructing the transaction. Request a top-up or reduce the transfer amount.

Effect.catchTag('Wallet.InsufficientFunds', (e) => {
console.log(`Need more ${e.tokenType}, shortfall: ${e.amount}`)
})

AddressError

An error indicating that the provided address is invalid.

FieldValue
_tag'Wallet.Address'
FieldsoriginalAddress: string

Fix: Validate the address format before use. To understand the address format, see the Address encoding section of the wallet SDK guide. The originalAddress field contains the rejected input.

Effect.catchTag('Wallet.Address', (e) => ...)

InvalidCoinHashesError

An error indicating that one or more coins are missing their required nonce hashes.

FieldValue
_tag'Wallet.InvalidCoinHashes'
FieldsmissingNonces: unknown[]

Fix: Ensure coins are fully synced before spending. The missingNonces field identifies the affected coins.

Effect.catchTag('Wallet.InvalidCoinHashes', (e) => ...)

TransactingError

Error during transaction construction or fee balancing.

FieldValue
_tag'Wallet.Transacting'

Fix: Check that inputs are valid and that the fee token balance is sufficient. Review transaction parameters.

Effect.catchTag('Wallet.Transacting', (e) => ...)

TransactionHistoryError

Error reading or writing the transaction history store.

FieldValue
_tag'Wallet.TransactionHistory'

Fix: Check local storage availability and permissions. A corrupt store history might be causing the error. Clearing and resyncing is a recovery option.

Effect.catchTag('Wallet.TransactionHistory', (e) => ...)

Unshielded wallet (@midnight-ntwrk/wallet-sdk-unshielded-wallet)

The unshielded wallet exposes eleven error types: all eight from the shielded wallet (same _tag values) plus five additional types below.

SignError

Failed to sign a transaction.

FieldValue
_tag'Wallet.Sign'

Fix: Ensure the signing key is available and not locked. Check hardware wallet connectivity if applicable.

Effect.catchTag('Wallet.Sign', (e) => ...)

ApplyTransactionError

Failed to apply a transaction to the local UTXO set.

FieldValue
_tag'Wallet.ApplyTransaction'

Fix: Usually follows a submission error. Verify that the node accepted the transaction before attempting to apply it locally.

Effect.catchTag('Wallet.ApplyTransaction', (e) => ...)

RollbackUtxoError

Failed to roll back a UTXO during a chain reorganisation.

FieldValue
_tag'Wallet.RollbackUtxo'

Fix: If rollback fails repeatedly, then the local UTXO state might be inconsistent. If that happens, then you might need a full resync.

Effect.catchTag('Wallet.RollbackUtxo', (e) => ...)

SpendUtxoError

Failed to mark a UTXO as spent.

FieldValue
_tag'Wallet.SpendUtxo'

Fix: The UTXO may already be spent or not present in the local set. To reconcile state, resync the wallet.

Effect.catchTag('Wallet.SpendUtxo', (e) => ...)

UtxoNotFoundError

A referenced UTXO could not be found in the local set.

FieldValue
_tag'UtxoNotFoundError'

Fix: Ensure the wallet is fully synced. The UTXO might have already been spent or the sync might be behind the chain tip.

Effect.catchTag('UtxoNotFoundError', (e) => ...)

DUST wallet (@midnight-ntwrk/wallet-sdk-dust-wallet)

The DUST wallet exposes four error types, all shared with the shielded wallet:

Error_tag
OtherWalletError'Wallet.Other'
SyncWalletError'Wallet.Sync'
TransactingError'Wallet.Transacting'
InsufficientFundsError'Wallet.InsufficientFunds'

For field details and fixes, see the Shielded wallet section.

Capabilities (@midnight-ntwrk/wallet-sdk-capabilities)

The capabilities package exposes three error types.

ProvingError

Wraps errors from the proving provider.

FieldValue
_tag'Wallet.Proving'

Fix: Check proof server connectivity and that you are loading the correct circuit keys. Inspect the wrapped cause for the underlying provider error.

Effect.catchTag('Wallet.Proving', (e) => ...)

SubmissionError (Capabilities)

Submission error raised at the capabilities/service layer.

FieldValue
_tag'SubmissionError'

Fix: Same as node-client SubmissionError. Check node connectivity and transaction validity.

Effect.catchTag('SubmissionError', (e) => ...)

InsufficientFundsError (Capabilities — native Error)

This is a plain JavaScript Error, not a Data.TaggedError. It is thrown (not yielded as an Effect failure) during coin selection.

Known messages: "Insufficient Funds: could not balance <tokenType>"

Where <tokenType> is the token identifier.

Fix: Catch with standard try/catch or Effect.tryPromise. Ensure the wallet has enough of the specified token type before invoking coin selection.

Utilities (@midnight-ntwrk/wallet-sdk-utilities)

The utilities package exposes five error types.

LedgerError

Wraps exceptions thrown by the ledger WASM module.

FieldValue
_tag'LedgerError'

Fix: Inspect the wrapped cause. Usually indicates invalid state passed to the ledger. Check that ledger inputs are well-formed.

Effect.catchTag('LedgerError', (e) => ...)

LeftError<L>

Raised when you encounter an Either.Left value where you expected a Right.

FieldValue
_tag'LeftError'

Fix: Check the logic that produces the Either value. A Left here indicates an unhandled error branch.

Effect.catchTag('LeftError', (e) => ...)

InvalidProtocolSchemeError

This error occurs when one or more of the network URLs provided uses an unsupported protocol scheme.

FieldValue
_tag'InvalidProtocolSchemeError'

Fix: Ensure URLs use the expected scheme (for example, ws:// or wss:// for WebSocket connections, http:// or https:// for HTTP).

Effect.catchTag('InvalidProtocolSchemeError', (e) => ...)

FailedToDeriveWebSocketUrlError

This error occurs when the system cannot derive a WebSocket URL from the provided input.

FieldValue
_tag'FailedToDeriveWebSocketUrlError'

Fix: Check that the input URL is well-formed and that the derivation logic covers the provided scheme/host combination.

Effect.catchTag('FailedToDeriveWebSocketUrlError', (e) => ...)

ClientError

A client-side networking error, corresponding to HTTP 400–499 status codes.

FieldValue
_tag'ClientError'

Fix: These indicate a problem with the request, such as bad input, authentication failure, or not found. Do not retry without changing the request. Inspect the error for the specific status code.

Effect.catchTag('ClientError', (e) => ...)

ServerError

A server-side error, corresponding to HTTP 500+ status codes.

FieldValue
_tag'ServerError'

Fix: For persistent 500 errors, check server logs. The SDK automatically retries on transient 502–504 errors (gateway/service unavailable errors).

Effect.catchTag('ServerError', (e) => ...)

Runtime (@midnight-ntwrk/wallet-sdk-runtime)

The runtime package exposes one error type.

WalletRuntimeError

A configuration error in the wallet runtime.

FieldValue
_tag'WalletRuntimeError'

Known messages:

  • "No variant to init": No wallet variant was provided during initialisation
  • "Empty variants list": The variants list supplied to the runtime is empty

Fix: Ensure that you configure at least one wallet variant before you initialise the runtime.

Effect.catchTag('WalletRuntimeError', (e) => ...)

Address format (@midnight-ntwrk/wallet-sdk-address-format)

The address format package exposes five error types.

These are plain JavaScript Error throws, not Data.TaggedError instances. Catch with standard try/catch.

MessageCause
"Expected prefix mn"Address does not start with the mn prefix
"Segment contains disallowed characters"Address segment has characters outside the allowed set
"Expected type <expected>, got <actual>"Address type byte does not match the expected type
"Coin public key needs to be 32 bytes long"Public key component is the wrong length
"Unshielded address needs to be 32 bytes long"Unshielded address payload is the wrong length
"Dust address is too large"DUST address exceeds the maximum allowed size

Fix: Validate address strings before passing them to the address-format API. Use the shielded wallet's AddressError ('Wallet.Address') for higher-level address validation.

Complete tag registry

All twenty-nine _tag values, alphabetically sorted
_tagPackageError type
'ClientError'@midnight-ntwrk/wallet-sdk-utilitiesClientError
'ConnectionError'@midnight-ntwrk/wallet-sdk-node-clientConnectionError
'FailedToDeriveWebSocketUrlError'@midnight-ntwrk/wallet-sdk-utilitiesFailedToDeriveWebSocketUrlError
'InvalidProtocolSchemeError'@midnight-ntwrk/wallet-sdk-utilitiesInvalidProtocolSchemeError
'LeftError'@midnight-ntwrk/wallet-sdk-utilitiesLeftError<L>
'LedgerError'@midnight-ntwrk/wallet-sdk-utilitiesLedgerError
'ParseError'@midnight-ntwrk/wallet-sdk-node-clientParseError
'ServerError'@midnight-ntwrk/wallet-sdk-utilitiesServerError
'SubmissionError'@midnight-ntwrk/wallet-sdk-node-client, @midnight-ntwrk/wallet-sdk-capabilitiesSubmissionError
'TransactionDroppedError'@midnight-ntwrk/wallet-sdk-node-clientTransactionDroppedError
'TransactionInvalidError'@midnight-ntwrk/wallet-sdk-node-clientTransactionInvalidError
'TransactionProgressError'@midnight-ntwrk/wallet-sdk-node-clientTransactionProgressError
'TransactionUsurpedError'@midnight-ntwrk/wallet-sdk-node-clientTransactionUsurpedError
'UtxoNotFoundError'@midnight-ntwrk/wallet-sdk-unshielded-walletUtxoNotFoundError
'Wallet.Address'@midnight-ntwrk/wallet-sdk-shielded, @midnight-ntwrk/wallet-sdk-unshielded-walletAddressError
'Wallet.ApplyTransaction'@midnight-ntwrk/wallet-sdk-unshielded-walletApplyTransactionError
'Wallet.InsufficientFunds'@midnight-ntwrk/wallet-sdk-shielded, @midnight-ntwrk/wallet-sdk-unshielded-wallet, @midnight-ntwrk/wallet-sdk-dust-walletInsufficientFundsError
'Wallet.InvalidCoinHashes'@midnight-ntwrk/wallet-sdk-shielded, @midnight-ntwrk/wallet-sdk-unshielded-walletInvalidCoinHashesError
'Wallet.Other'@midnight-ntwrk/wallet-sdk-shielded, @midnight-ntwrk/wallet-sdk-unshielded-wallet, @midnight-ntwrk/wallet-sdk-dust-walletOtherWalletError
'Wallet.Proving'@midnight-ntwrk/wallet-sdk-capabilitiesProvingError
'Wallet.RollbackUtxo'@midnight-ntwrk/wallet-sdk-unshielded-walletRollbackUtxoError
'Wallet.Sign'@midnight-ntwrk/wallet-sdk-unshielded-walletSignError
'Wallet.SpendUtxo'@midnight-ntwrk/wallet-sdk-unshielded-walletSpendUtxoError
'Wallet.SubmissionWalletError'@midnight-ntwrk/wallet-sdk-shielded, @midnight-ntwrk/wallet-sdk-unshielded-walletSubmissionError (wallet)
'Wallet.Sync'@midnight-ntwrk/wallet-sdk-shielded, @midnight-ntwrk/wallet-sdk-unshielded-wallet, @midnight-ntwrk/wallet-sdk-dust-walletSyncWalletError
'Wallet.Transacting'@midnight-ntwrk/wallet-sdk-shielded, @midnight-ntwrk/wallet-sdk-unshielded-wallet, @midnight-ntwrk/wallet-sdk-dust-walletTransactingError
'Wallet.TransactionHistory'@midnight-ntwrk/wallet-sdk-shielded, @midnight-ntwrk/wallet-sdk-unshielded-walletTransactionHistoryError
'WalletRuntimeError'@midnight-ntwrk/wallet-sdk-runtimeWalletRuntimeError