# Exit codes

| Code | Meaning |
|------|---------|
| `0` | At least one vantage (or gateway) returned `retrievable: true`. Includes `retrievable` and `partial` statuses. |
| `2` | No vantage returned `retrievable: true`. Includes `unretrievable` (every vantage said no or errored) and `error` (every vantage errored). |
| other | Unexpected error: arg parsing failed, invalid reference, internal panic, etc. |

The shape is intentionally coarse: `0` = "someone in your fleet
can get it", `2` = "no one can". For finer-grained CI logic, pipe
`--output json` through `jq` instead of relying on exit codes.

## CI integration patterns

Fail a CI job if a reference becomes unretrievable from any of three
vantages:

```bash
bee-check <ref> --bee a.example --bee b.example --bee c.example --output json | \
  jq -e '.vantages | all(.retrievable == true)'
```

Alert on `partial` status (any retrievability degradation):

```bash
bee-check <ref> --bee a.example --bee b.example --output json | \
  jq -e '.status == "retrievable"'
```

Track p95 over time:

```bash
bee-check <ref> --per-chunk --output json | \
  jq '.chunk_stats.per_vantage[].elapsed_p95_ms'
```
