> ## Documentation Index
> Fetch the complete documentation index at: https://docs.allocait.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Holding and rule errors

> Errors for holdings, cash, rules and files.

These codes cover holdings and cash writes, and rule and rules text writes.

| Code | Meaning |
| - | - |
| `WOULD_CLOSE_POSITIONS` | An `replace_positions` call left out holdings you still own. |
| `INSUFFICIENT_CASH` | A buy or a withdrawal would overdraw the cash balance. |
| `IDEMPOTENCY_KEY_CONFLICT` | An `idempotency_key` was reused with a different cash movement. |
| `RULES_INVALID` | The rules text failed to parse. |
| `TARGET_OUT_OF_BAND` | A rule's target falls outside its own band. |

Refusals for negative share counts, Moves on Options and a mark outside Options are listed under `INVALID_INPUT`, and turning Allow shorts off while a short is held under `IN_USE`, in [Record and price errors](https://docs.allocait.app/claude/errors/records-and-prices.md).

## Holdings and cash

**WOULD\_CLOSE\_POSITIONS**

`replace_positions` left out holdings you still own, and the message names them. Include them, or add a `{symbol, shares: 0, price}` row for each one you mean to close. For one holding, use `save_position`. Close only what you no longer hold.

**INSUFFICIENT\_CASH**

A buy or a withdrawal would overdraw the cash balance, including a balance of zero. For a buy, the message says how much more cash the trades need. If you have a deposit that isn't recorded, or are bringing in holdings you already owned, record the deposit with `record_cash_movement` first; otherwise Claude asks you. For a withdrawal, the message says the amount is more than the recorded balance, with no figure, and Claude asks you which is wrong, the amount or the balance.

**IDEMPOTENCY\_KEY\_CONFLICT**

An `idempotency_key` was reused with a different cash movement. Use a new key for a new movement.

## Rules

**RULES\_INVALID**

The rules text failed to parse. The message lists every issue found (missing frontmatter, a class with no min, max or size range, an unknown key, a duplicate class name) and a short valid example. Nothing was written. Fix every issue it names and try again.

**TARGET\_OUT\_OF\_BAND**

A rule's target falls outside its own band. Nothing was written. Adjust the target or the band and try again.

## Next steps

> [card] [Update with an agent](https://docs.allocait.app/guides/update-with-an-agent.md)
>
> Sync holdings and cash through tools or REST.

> [card] [Rules text format](https://docs.allocait.app/concepts/rules-text-format.md)
>
> The keys and class names a file accepts.

> [card] [Targets](https://docs.allocait.app/concepts/targets.md)
>
> How a target sits inside a band.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.