---
url: /errors/cannot_sell_empty_position.md
---
# `cannot_sell_empty_position`

`cannot_sell_empty_position`

## Description

The switch tries to sell 100% of a position whose current amount is zero.

## HTTP Status

`422 Unprocessable Content`

## `doc_url` Format

The `doc_url` value is an absolute URL and changes by environment:

`<docs-base-url>/errors/cannot_sell_empty_position`

## Typical Causes

* A full-position sell was requested after the position had already been closed.
* The request was built from stale position data.
* A zero-valued position was retained in the latest position snapshot.

## Example

Response:

```json
{
  "errors": [
    {
      "code": "cannot_sell_empty_position",
      "message": "Cannot sell 100 percent of empty position for instrument 019d0000-0000-7000-8000-000000000001",
      "doc_url": "https://docs.example.com/errors/cannot_sell_empty_position"
    }
  ]
}
```

## How To Fix

1. Refresh the current positions before building the switch.
2. Remove the sell leg for the empty position.
3. Retry only if the position has a non-zero amount.
