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

# 错误和速率限制

> 常见的 Fetch Hive API 错误响应、状态码和工作流并发行为

# 错误和速率限制

对于无效或失败的公开 API 请求，Fetch Hive 会返回 JSON 错误。运行时公开 API 错误包含人类可读的 `message`、一个稳定的代码，以及作为兼容别名的 `error`。

## 错误响应格式

```json theme={null}
{
  "error": "Invalid access.",
  "message": "Invalid access.",
  "error_code": "validation_error"
}
```

部分套餐和速率限制响应也会包含 `code` 以兼容现有客户端。新客户端应读取 `error_code`。完整的代码列表、目录接口和客户端处理指南，请参阅[错误代码](./error-codes)。

## 常见状态码

### `401 Unauthorized`

当 `Authorization` 请求头缺失、无效或使用了已吊销的 API 密钥时，Fetch Hive 返回 `401`。

示例：

```json theme={null}
{
  "error": "Invalid access."
}
```

### `404 Not Found`

当请求的资源不存在于你的账户中时,Fetch Hive 返回 `404`。

工作流运行响应示例：

```json theme={null}
{
  "error": "Prompt workflow run not found"
}
```

请求查询响应示例：

```json theme={null}
{
  "error": "Request not found"
}
```

### `422 Unprocessable Entity`

当请求已认证但对该接口无效时，Fetch Hive 返回 `422`。

示例：

```json theme={null}
{
  "error": "Agent not found."
}
```

```json theme={null}
{
  "error": "Data set not found."
}
```

```json theme={null}
{
  "error": "You've reached your credit cap."
}
```

### `502 Bad Gateway`

当提供商在处理提示词或智能体请求时失败,Fetch Hive 返回 `502`。

示例：

```json theme={null}
{
  "error": "openai API error: provider rejected the request"
}
```

## 速率限制和并发

公开 API 请求会计入你的套餐每日 API 调用上限。如果超出该上限,Fetch Hive 会在运行请求前返回 `429 Too Many Requests`。

每日 API 上限响应示例：

```json theme={null}
{
  "error": "Daily API rate limit reached",
  "code": "api_rate_limit_exceeded",
  "message": "You have reached your daily limit of 50 API calls. Resets at midnight UTC. Upgrade your plan for higher limits.",
  "limit": 50,
  "current": 50
}
```

工作流并发取决于你的套餐。

| 套餐         | 并发上限 |
| ---------- | ---- |
| Lite       | 1    |
| Starter    | 3    |
| Pro        | 5    |
| Entreprise | 自定义  |

如果超出并发上限,Fetch Hive 返回 `429 Too Many Requests`。

示例：

```json theme={null}
{
  "error": "You've reached your concurrency limit. Try again later or use async mode."
}
```

如果在工作流请求上看到此响应，请稍后重试或切换到回调投递,以便 Fetch Hive 可以将该运行入队。

## 相关内容

* 请参阅[身份验证](./authentication)了解必需的 bearer 请求头
* 请参阅[错误代码](./error-codes)了解稳定的 `error_code` 值和 `GET /v1/error_codes`
* 请参阅[调用工作流](./workflows/invoke)了解回调投递的工作流请求
