跳转到内容
搜索文档

错误代码

最后更新 查看 MarkdownAgent 设置

本页记录使用 Queues Cloudflare API 时 Queues 返回的错误代码。

错误返回方式

对于 JavaScript API,Queues 操作会抛出可捕获的异常。错误代码包含在 message 属性的末尾:

try {
	await env.MY_QUEUE.send("message", { delaySeconds: 999999 });
    return new Response("Sent message to the queue");
} catch (error) {
	console.error(error);
	return new Response("Failed to send message to the queue", { status: 500 });
}

对于通过 HTTP 的 Cloudflare API,响应将包含 errors 对象,其中包含 messagecode 字段:

{
  "errors": [
    {
      "code": 7003,
      "message": "No route for the URI",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "success": true
}

错误代码参考

客户端错误

错误代码 错误 详情 建议操作
10104 QueueNotFound 队列不存在 List Queues 端点 中检查 queue_id 是否存在
10106 Unauthorized 未授权请求 确保当前用户有权限向该队列推送。
10107 QueueIDMalformed 请求 URL 中的队列 ID 不是有效的队列标识符 确保 queue_id 仅包含字母数字字符。
10201 ClientDisconnected 请求处理期间客户端断开连接 考虑增加超时并重试消息发送。
10202 BatchDelayInvalid 无效的批延迟 确保 batch_delay 在 1 到 86400 秒之间
10203 MessageMetadataInvalid 无效的消息元数据(包括无效内容类型和无效延迟) 确保 contentTypetextbytesjsonv8 之一。确保消息延迟不超过最长 24 小时
10204 MessageSizeOutOfBounds 消息大小超出范围 确保消息大小在 0 到 128 KB 之间
10205 BatchSizeOutOfBounds 批大小超出范围 确保批大小在 0 到 256 KB 之间
10206 BatchCountOutOfBounds 批计数超出范围 确保批计数在 0 到 100 条消息之间
10207 JSONRequestBodyInvalid 请求 JSON 正文与预期架构不匹配 确保 JSON 正文符合预期架构
10208 JSONRequestBodyMalformed 请求正文不是有效的 JSON REST API 请求正文无效。查看错误消息获取更多详情。

429 类错误

错误代码 错误 详情 建议操作
10250 QueueOverloaded 队列过载 暂时减少向队列发送消息。
10251 QueueStorageLimitExceeded 队列存储限制超出 清除队列 或等待队列处理积压
10252 QueueDisabled 队列已禁用 取消暂停队列
10253 FreeTierLimitExceeded 免费套餐限制超出 升级到 Workers Paid

500 类错误

错误代码 错误 详情
15000 UnknownInternalError 未知错误

这篇文档对您有帮助吗?