# Error Codes

The cloud agent returns informative errors codes where possible, resorting to a generic message for all other cases.

## Error codes

| Code                            | Description                                                                                                                                                                                                          |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `InvalidArgumentError`          | Returned by any `query` or `mutation` when invalid arguments or invalid argument combinations are submitted.                                                                                                         |
| `DecodingError`                 | Returned when a string-encoded JSON input argument cannot be successfully decoded to valid JSON.                                                                                                                     |
| `ResourceAlreadyExistsError`    | Returned when attempting to create a resource (e.g. an `AnoncredsSchema` etc.) which already exists.                                                                                                                 |
| `LedgerWriteError`              | Returned when the cloud agent fails to write an `AnoncredsSchema` or `AnoncredsCredDef` to the ledger, and the cause of failure is unknown.                                                                          |
| `ResourceNotFoundError`         | Returned when attempting to fetch a resource (e.g. a `Connection`, `Credential`, exchange, ledger resource etc.) which does not exist.                                                                               |
| `CannotIssueWithCredDefError`   | Returned when attempting to issue an Anoncreds credential but the specified `credDefId` references a credential definition which was not created by the cloud agent.                                                 |
| `ExchangeInAbandonedStateError` | Returned when attempting to perform an operation on an exchange, but the exchange is in the state `ABANDONED` and therefore the cloud agent cannot fulfill the operation request.                                    |
| `IncompletePresentationError`   | Returned when attempting to accept a proof request by submitting a presentation, but the submitted presentation is lacking sufficient arguments such that the proof request is not fulfilled. e.g. missing referents |

## Generic errors

As a fallback, generic errors are returned from the cloud agent in the following form, where `<uuidv4>` is replaced with a random UUID v4.

```
Service error. RefId: <uuidv4>
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sudoplatform.com/guides/decentralized-identity/cloud-agent/cloud-agent-admin-api/error-codes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
