# Errors

Every error code a Cobroker tool can return, what it means and what to do.

A tool that fails returns an error result instead of data. Its text is a short message followed by the code in parentheses, for example "Not enough credits for this. (insufficient_credits)", plus a retry delay or a billing link when there is one. The same facts are in the result's `_meta` under `cobroker/error`: `code`, `message` and details such as `retry_after_seconds`, `billing_url` or `retryable`.

Refusals before any tool runs are HTTP answers, not tool errors: sign-in, the private beta's `not_enabled`, and others. See [Server details](/docs/server#refusals-before-any-tool-runs).

When a spend is refused before anything was charged, the message says so and the same `quote_id` works again until it expires (`quote_reusable: true`).

## Requests

### invalid_request

The request was not valid: a missing or wrong input, or a value out of range. The message says what. Fix the inputs and call again.

### not_found

Cobroker could not find the parcel, list or other item named. Check the id, for example with `list_lists`.

### conflict

The request conflicts with the current state. Read it again, then retry.

### forbidden

Not allowed, for example changing a list you can only view. Ask the list's owner for edit access.

### rate_limited

A limit was reached: calls a minute, calls a day, calls running at once, or one of the app's daily limits. When the wait is known, the error gives `retry_after_seconds`. `limit` names the limit. See [Server details](/docs/server#limits).

### timeout

Cobroker took too long to answer. Try again, or narrow the request (a smaller area, a filter, fewer rows).

## Plans and accounts

### insufficient_credits

The balance does not cover this. The error carries the credits `required`, the `balance` and a `billing_url`. Open the billing link in Cobroker. If the message says nothing was charged, the same `quote_id` works again until it expires.

### subscription_required

This needs a paid Cobroker plan. The error may carry a `billing_url`.

### feature_unavailable

The feature is not available on this account, or not available to assistants right now. No wait opens it.

### account_suspended

This Cobroker account's access has been suspended. Nothing works through the server until it is restored.

### account_not_ready

The account is not set up yet. Open Cobroker once while signed in, then connect again:

```text
https://app.cobroker.ai/discovery/map
```

### account_check_unavailable

Cobroker could not confirm the account just now, so changes and spending are paused. Reads still work. Try again in a moment.

## Quotes and spending

### quote_required

The tool spends credits and was called without a `quote_id`. Call the quote tool the error names, then pass its `quote_id`.

### quote_invalid

The `quote_id` cannot be used. There are two cases, and the message says which:

- **Already used on this same request** (`already_used: true`, `retryable: false`): the spend may already have gone through. Check the result with the read tool the error names (`check_with`) or in Cobroker before doing anything else. Do not repeat the spend if it is there.
- **Unknown, expired, made by another account or for a different request:** call the quote tool again with the same details.

### quote_stale

The price or credit pricing changed since the quote. Nothing was charged. Get a new quote.

### spend_in_progress

Another spend for this account is still running. Wait for it to finish, then try again.

### spend_outcome_unknown

Cobroker did not confirm this spend in time. It may still go through and charge credits. Do not call the spend tool again until you have checked the result with the read tool the error names (`check_with`) or in Cobroker.

### spend_result_unavailable

The spend went through and was charged, but its result could not be returned. Find the result with a read tool (for a saved list, `list_lists`). Do not spend again.

## Cobroker's side

### upstream_error

Cobroker could not complete this right now. Try again in a moment. When the error says `retryable: false`, the same request gets the same answer: narrow it instead.

### server_not_configured

Part of the server is not set up on Cobroker's side. The message says what, and how to get the result another way when there is one.

### internal_error

Cobroker hit an unexpected error on this call. Try again in a moment.
