# Read refusals

> What a failure looks like over MCP and the CLI, and which fields to read.

Every refused call returns a structured error document whose `hint` tells the caller what to do next.

- **Over MCP**: Returned as a tool result with `isError: true`.
- **From the CLI (`pixling call`, `pixling rpc`, `--json`, or `PIXLING_FORMAT=json`)**: Printed as the same JSON document on stdout, paired with a non-zero exit code (or as an `"ok": false` line in `rpc`).

```json title="Refusal payload"
{
  "ok": false,
  "operation": "resident.set",
  "error": {
    "code": "rejected",
    "detail": "boundToAnotherClient",
    "hint": "A resident.ensure-bound resident requires `to: client:<namespace>/<key>` (binding.selector) for writes; entityID, No.N#k and names are refused even for your own binding. This error does not identify the binding's owner; reading is fine."
  }
}
```

## Common refusals and quick fixes

| `error.code` / `detail` | What happened | Quick fix |
| --- | --- | --- |
| `targetNotFound` | Unbound or stowed `client:<namespace>/<key>`, or missing selector | Check `resident.ensure` for `onDesk` vs. `stowed`; use a new `key` if stowed |
| `targetMustBeSingular` or `rejected` / `autoNotSupported` | Selector matched several residents (`No.7`, `everyone`) or used `auto` where one is required | Pass a single desk copy (`No.7#1`) or `client:<namespace>/<key>` |
| `invalidArguments` (with `error.field`) | Missing required key, wrong type, unknown key, or out-of-range value | Fix the exact argument path reported in `error.field` |
| `rejected` (`boundToAnotherClient`, `held`, `wallpaperPinned`) | Wrong selector on a bound resident, user is holding it, or it is pinned to the wallpaper | Address bound residents by `client:<namespace>/<key>`, retry after release, or move off the wallpaper |
| `rejected` / `toolFamilyOff` or `unavailable` | Optional MCP tool group is off in Studio, or Pixling / the connection is off | Enable the group or connection in **Settings** › **Connect** and refresh `tools/list` |

## Refusal fields

| Field | Always present | Meaning |
| --- | --- | --- |
| `error.code` | Yes | Machine-readable failure kind from a closed list ([failure codes](/docs/reference/operations/#failure-codes)). |
| `error.detail` | Yes | Narrows down the cause, such as which rule refused the call. |
| `error.hint` | Yes | Concrete next step written for the caller. |
| `error.field` | On `invalidArguments` | Path to the bad argument, such as `steps[2].to`. |
| `error.candidates` | On ambiguous targets | Matching residents when a selector hits more than one target. |

## CLI exit codes

| Exit code | Meaning |
| --- | --- |
| `0` | Success |
| `64` | Usage error |
| `3` | Cannot connect, capability unavailable, not allowed, busy or rate-limited, or `unknownOperation` |
| `4` | Target could not be resolved: not found, ambiguous, or several matched where one is required |
| `5` | Refused |
| `70` | Internal error |

## Version mismatch between CLI and app

Receiving `unknownOperation`, or seeing a tool your client does not recognize, means the client and the Pixling app are on different builds.

> [!TIP]
> **Check for a build mismatch**
> Compare the `app` field returned by `capabilities.get` against the CLI version:
>
> 
```sh title="Terminal"
pixling --version
```
>
> Update or restart Pixling, then refresh the client's tool list.

## Next steps

- [Failure codes](/docs/reference/operations/#failure-codes): Closed list of error codes returned by Pixling operations.
- [Effects and retries](/docs/connect/effects/): Which calls persist state and which are safe to resend.
