# anthropic: Handle additional API error codes \(\#62984\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/5255bd7f279b3a21e59615d3c77e978840b2530d)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 5255bd7f279b3a21e59615d3c77e978840b2530d

Requested commit: 5255bd7f279b3a21e59615d3c77e978840b2530d

Commit: 5255bd7f279b3a21e59615d3c77e978840b2530d

Tree: 8086f858e27875e0c2c60f813e65f4ebff06dc30

Author: Conrad Irwin

Committer: GitHub

## Message

```
anthropic: Handle additional API error codes (#62984)

Anthropic now returns distinct error types for billing failures, request
conflicts, and gateway timeouts. Because the Anthropic client did not
recognize these values, they fell through to
`LanguageModelCompletionError::Other`, losing their structured status
and causing callers to apply generic handling.

Recognize the documented `billing_error`, `conflict_error`, and
`timeout_error` codes. Billing failures now become `PaymentRequired`,
conflicts preserve their HTTP 409 status and provider message, and
timeouts become typed upstream HTTP 504 failures. End-to-end tests
exercise each mapping through the HTTP response parsing path.

Testing:

- `cargo fmt --check`
- `cargo nextest run -p anthropic`
- `./script/clippy -p anthropic`
- `git diff --check`

Release Notes:

- Fixed handling of Anthropic billing, conflict, and timeout errors.
```

## Parents

- [91bf967e279fba3b326c096aeb66053cb2373547](https://git.cafe/gitcafe/zed/commit/91bf967e279fba3b326c096aeb66053cb2373547?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/5255bd7f279b3a21e59615d3c77e978840b2530d?format=markdown)
