> For the complete documentation index, see [llms.txt](https://velora-1.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://velora-1.gitbook.io/docs/reference/errors.md). Agents can also search and read this documentation through its [MCP server](https://velora-1.gitbook.io/docs/~gitbook/mcp).

# Error Codes

The program returns these `ErrorCode` variants. Anchor assigns numeric codes starting at `6000` in declaration order (so `ZeroAmount = 6000`, `InvalidSchedule = 6001`, …). The exact numbers also appear in the generated IDL.

| Variant                | Message                                                    | Raised by                                                      |
| ---------------------- | ---------------------------------------------------------- | -------------------------------------------------------------- |
| `ZeroAmount`           | Stream total amount must be greater than zero.             | `create_stream`                                                |
| `InvalidSchedule`      | Stream end timestamp must be greater than start timestamp. | `create_stream` (also cliff bounds)                            |
| `SameRecipientCreator` | Stream recipient and creator cannot be the same wallet.    | `create_stream`                                                |
| `UnsupportedSchedule`  | Schedule type is not supported for this instruction.       | `release_milestone` (non-Milestone stream)                     |
| `Unauthorized`         | Signer is not authorized for this stream.                  | `withdraw`, `cancel`, `release_milestone`, account constraints |
| `StreamNotActive`      | Stream is not active.                                      | `withdraw`, `release_milestone`                                |
| `NothingToWithdraw`    | There are no unlocked tokens available to withdraw.        | `withdraw`                                                     |
| `AlreadyCancelled`     | Stream is already cancelled.                               | `cancel`                                                       |
| `FullyVested`          | Stream is already fully vested.                            | `cancel` (completed or fully unlocked)                         |
| `StreamExpired`        | Stream has expired.                                        | `release_milestone` (`now > end`)                              |
| `MathOverflow`         | Vesting math overflowed.                                   | any arithmetic path                                            |
| `InvalidMint`          | Token account mint does not match the stream mint.         | account constraints                                            |
| `InvalidVault`         | Vault token account does not match the stream vault.       | `withdraw`, `cancel`                                           |
| `CancellationDisabled` | Cancellation is disabled for this stream.                  | `cancel` (`is_cancellable == false`)                           |
| `InvalidCliffAmount`   | Cliff amount cannot exceed the total stream amount.        | `create_stream` (`CliffLinear`)                                |

## Handling errors in TypeScript

Anchor surfaces these as `AnchorError` with `error.errorCode.code` (the variant name) and `error.errorCode.number` (the numeric code):

```ts
try {
  await program.methods.withdraw().accounts({ /* ... */ }).rpc();
} catch (err) {
  if (err.error?.errorCode?.code === "NothingToWithdraw") {
    // nothing has unlocked yet — back off and retry later
  } else {
    throw err;
  }
}
```


---

# 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://velora-1.gitbook.io/docs/reference/errors.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.
