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

# Tool errors

> Server-tool failures in the standard envelope.

Tool failures use the standard [error envelope](/api/api-reference/errors-and-rate-limits/error-envelope): an HTTP error before generation, or a chunk with a top-level `error` and `finish_reason: "error"` mid-stream.

## Causes

| Condition | Code |
| - | - |
| Web search or fetch on a model that does not advertise it | `invalid_request` |
| Duplicate tool aliases that resolve to the same server tool | `invalid_request` |
| Provider failure while a tool ran | `provider_error` (`502`) or `unavailable` (`503`) |

Branch on `error.code`. Check the model's `capabilities` before sending a tool.

## Related

* [Error envelope](/api/api-reference/errors-and-rate-limits/error-envelope)
* [Status mapping](/api/api-reference/errors-and-rate-limits/status-mapping)
* [Web search](/api/api-reference/server-tools/web-search)


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