> For the complete documentation index, see [llms.txt](https://docs.zama.org/protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zama.org/protocol/sdk/api-references/error-codes.md).

# Daemon error codes

Error codes the Zama SDK daemon returns to Go and Rust applications, with what each one means and how to respond.

Go and Rust applications receive two kinds of error codes. SDK codes, such as `SIGNING_REJECTED` or `DECRYPTION_FAILED`, are the same codes the TypeScript SDK uses; see [Handle errors](https://docs.zama.org/protocol/sdk/guides/handle-errors.md) and the [SDK error reference](https://docs.zama.org/protocol/sdk/api-references/sdk/errors.md). Daemon codes, listed on this page, report a problem with the daemon, an SDK context, or a callback channel.

Read the code from Go `SDKError.Code`, using `errors.As`, or from Rust `ClientError::sdk_error()`. A callback channel failure is returned by Go `WaitChannelFailure` or Rust `wait_channel_closed`. Go exports constants for some codes, such as `zama.CodeTransactionOutcomeUnknown` and `zama.CodeStorageFailed`; compare the others as strings.

The daemon sets `Retryable: false` on these codes. The **Retry** column says when repeating the call makes sense.

## Requests and SDK contexts

| Code                          | Meaning                                                                                                                                                                | Retry                        | What to do                                                                                                                                                                                                                                                        |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `INVALID_ARGUMENT`            | The daemon rejected a malformed request or callback reply, such as an invalid field or an account on a context without a signer.                                       | No                           | Fix the request. The message names the problem.                                                                                                                                                                                                                   |
| `CANCELLED`                   | The operation stopped before it finished: the caller cancelled it or its deadline passed, the SDK context closed, its account changed, or the daemon is shutting down. | Yes, once the cause is gone  | If the operation was a contract write that had reached your wallet, you receive `TRANSACTION_OUTCOME_UNKNOWN` instead.                                                                                                                                            |
| `CONTEXT_LIMIT`               | The daemon already holds `ZAMA_SDK_DAEMON_MAX_CONTEXTS` SDK contexts.                                                                                                  | After closing a context      | Close contexts you no longer use, or raise the limit in the [daemon configuration](https://docs.zama.org/protocol/sdk/api-references/daemon-configuration.md).                                                                                                    |
| `CONTEXT_NOT_FOUND`           | The SDK context no longer exists: it was closed, or the daemon restarted.                                                                                              | After creating a new context | Create a new SDK context with the same configuration and storage. See [Recover from disconnections](https://docs.zama.org/protocol/sdk/go-and-rust-guide/guides/recover-from-disconnections.md).                                                                  |
| `OPERATION_LIMIT`             | The SDK context already runs `ZAMA_SDK_DAEMON_MAX_OPERATIONS_PER_CONTEXT` operations.                                                                                  | After an operation finishes  | Limit concurrent calls per context, or raise the limit.                                                                                                                                                                                                           |
| `OPERATION_EXISTS`            | An operation with the same ID is already running in this context. The clients generate operation IDs, so this points to a client defect.                               | No                           | Report it with your client version.                                                                                                                                                                                                                               |
| `ACCOUNT_CHANGING`            | An account update is in progress on this SDK context.                                                                                                                  | After the update completes   | Wait for `UpdateAccount` / `update_account` to return, then send the operation again.                                                                                                                                                                             |
| `TRANSACTION_OUTCOME_UNKNOWN` | A contract write reached your wallet, and the daemon cannot tell whether it was broadcast.                                                                             | Not until reconciled         | Check your transaction records and the chain first. See [Resolve uncertain transaction outcomes](https://docs.zama.org/protocol/sdk/go-and-rust-guide/guides/uncertain-transaction-outcomes.md). Go `IsOutcomeUnknown` and Rust `is_outcome_unknown()` detect it. |
| `INTERNAL`                    | The daemon hit an unclassified failure. The message is generic; the daemon writes `[zama-daemon] INTERNAL <error type>` to stderr.                                     | No                           | Check the daemon logs. See [Monitor and troubleshoot](https://docs.zama.org/protocol/sdk/go-and-rust-guide/operations/monitor-and-troubleshoot.md).                                                                                                               |

## Credential storage

| Code                     | Meaning                                                                                                                                                                                                                    | Retry                        | What to do                                                                                                                                                                                 |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `STORAGE_NOT_PRIVATE`    | The daemon SQLite directory or its `credentials.sqlite` file is not private to the daemon UID.                                                                                                                             | After fixing permissions     | Give the directory mode `0700` and the file mode `0600`, both owned by the daemon UID.                                                                                                     |
| `STORAGE_OPEN_FAILED`    | The daemon could not open its SQLite store, for example because the volume is read-only or another daemon holds the database lock.                                                                                         | After fixing the volume      | See [Monitor and troubleshoot](https://docs.zama.org/protocol/sdk/go-and-rust-guide/operations/monitor-and-troubleshoot.md). Each daemon needs its own storage volume.                     |
| `STORAGE_FAILED`         | The daemon SQLite store failed and rejects further access until the daemon restarts. The Go and Rust clients also send this code to the daemon when your application storage backend returns an error without an SDK code. | After the restart or the fix | For daemon SQLite, fix the filesystem and restart the daemon. For application storage, check your backend.                                                                                 |
| `STORAGE_UNAVAILABLE`    | The application storage channel closed while the SDK needed it.                                                                                                                                                            | After restoring the channel  | Reattach storage in Go, or rebuild the SDK context in Rust. See [Recover from disconnections](https://docs.zama.org/protocol/sdk/go-and-rust-guide/guides/recover-from-disconnections.md). |
| `STORAGE_ATTACH_TIMEOUT` | A storage request waited 10 seconds without an attached application storage channel.                                                                                                                                       | After attaching the channel  | Attach application storage before running operations that need credentials.                                                                                                                |
| `STORAGE_CHANNEL_EXISTS` | The context already has an attached storage channel, or its storage is closed.                                                                                                                                             | No                           | Attach storage once per SDK context. After the context closes, create a new one.                                                                                                           |

## Callback channels

| Code                    | Meaning                                                                                                                             | Retry                       | What to do                                                                                                                                                                                                        |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SIGNER_ATTACHED`       | The SDK context already has an attached signer channel.                                                                             | No                          | Reattach a wallet only after its signer channel has closed.                                                                                                                                                       |
| `EVENT_ATTACHED`        | The SDK context already has an attached event channel.                                                                              | No                          | Close the current subscription before subscribing again.                                                                                                                                                          |
| `EVENT_BACKPRESSURE`    | The event subscriber left 256 events unacknowledged, so the daemon closed the event channel.                                        | After resubscribing         | Return from event handlers promptly, then subscribe again. Missed events are not replayed. See [Observe events](https://docs.zama.org/protocol/sdk/go-and-rust-guide/guides/observe-events.md).                   |
| `CALLBACK_BACKPRESSURE` | The daemon queued 256 messages on a signer, storage, or event channel that your application did not read, so it closed the channel. | After restoring the channel | Check that your application keeps reading the channel, then restore it as described in [Recover from disconnections](https://docs.zama.org/protocol/sdk/go-and-rust-guide/guides/recover-from-disconnections.md). |
| `EVENT_ENCODING_FAILED` | The daemon could not encode an SDK notification and closed the event channel. It also logs the code to stderr.                      | After resubscribing         | Subscribe again. Report the failure with your daemon version if it repeats.                                                                                                                                       |

## Codes your application does not see

The clients handle these codes, or the daemon only writes them to stderr:

* `SIGNER_ACTION_NOT_FOUND`, `STORAGE_REQUEST_NOT_FOUND`, and `EVENT_DELIVERY_NOT_FOUND`: the daemon received a callback reply for a request that already ended, for example after a cancellation. The clients ignore them.
* `CALLBACK_FAILED`: the client sends it to the daemon when your event handler returns an error or panics. SDK operations continue.
* `SHUTDOWN_DEADLINE_EXCEEDED` and `SHUTDOWN_GRACE_EXCEEDED`: stderr lines written when shutdown outlasts `ZAMA_SDK_DAEMON_SHUTDOWN_TIMEOUT_MS` or the server's own grace period. See [Upgrade the daemon](https://docs.zama.org/protocol/sdk/go-and-rust-guide/operations/upgrade-and-recover.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zama.org/protocol/sdk/api-references/error-codes.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
