CLIProxyAPI icon indicating copy to clipboard operation
CLIProxyAPI copied to clipboard

{"error":{"message":"auth_unavailable: no auth available","type":"server_error","code":"internal_server_error"}}

Open aogg opened this issue 8 months ago • 11 comments

会出现一个会话刚开始的有几次会不断报错

Image

当第一个请求出现ai端报错时

cliproxyapi报错如下

HTTP/1.1 500 Internal Server Error
Server: openresty/1.29.2.1
Date: Sat, 21 Mar 2026 02:23:03 GMT
Content-Type: application/json
Content-Length: 105
Connection: keep-alive
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
Access-Control-Allow-Origin: *

{"error":{"message":"请求错误(状态码: 500)","type":"server_error","code":"internal_server_error"}}

远端报错如下

HTTP/2.0 500 Internal Server Error
date: Sat, 21 Mar 2026 02:23:03 GMT
content-type: text/plain; charset=utf-8
server: cloudflare
x-content-type-options: nosniff
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=4ov66RHzsAzxj%qweqwe%2F%qweqwe%3D%3D"}]}
cf-ray: 9df97dddff516864-NRT

请求错误(状态码: 500)

后续连续几个重试接口就一直报下面错误

HTTP/1.1 500 Internal Server Error
Server: openresty/1.29.2.1
Date: Sat, 21 Mar 2026 02:24:46 GMT
Content-Type: application/json
Content-Length: 112
Connection: keep-alive
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
Access-Control-Allow-Origin: *

{"error":{"message":"auth_unavailable: no auth available","type":"server_error","code":"internal_server_error"}}

token都是正确的


管理中心版本
dev
CLI Proxy API 版本

检查更新
v6.8.55
构建时间
2026/3/16 22:33:44

aogg avatar Mar 21 '26 02:03 aogg

token/auth都是正确

特别是 report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=4ov66RHzsAzxj%qweqwe%2F%qweqwe%3D%3D"}]} 到底是什么意思

aogg avatar Mar 21 '26 02:03 aogg

后续的连续报错都是在cliproxyapi这边就报错了,没有到远端的claude code

aogg avatar Mar 21 '26 02:03 aogg

cloudflare问题,你部署在哪

0xzkslr-ai avatar Mar 21 '26 06:03 0xzkslr-ai

别的人的ai服务,我哪知道,应该就是加了cloudflare网关。我只是使用人员

aogg avatar Mar 21 '26 06:03 aogg

我使用 Claude Code(2.1.70) 调用 CPA Antigravity OAuth 的 claude 模型时遇到同样问题了。Antigravity 账号有问题时还能正常返回错误,提示我账号需要认证,等我用认证 url 把 Antigravity 账号问题搞定之后就开始出这个错误了。我猜可能是接入 Antigravity 时 CPA 解包方式与 claude 发的包不匹配,没有识别到密钥,返回了 “no auth available”。

CodeCroon avatar Mar 21 '26 15:03 CodeCroon

重启下 CPA 就可以了,以前是账号开了下关了下就重置了,现在如果该账号的某个模型第一次报错了,那就会一直报 no auth available 的错误,即使把禁止冷却打开也没用效果。只能重启下 CPA 程序这样就恢复了。

lzdyes avatar Mar 22 '26 11:03 lzdyes

应该是最近几个版本更新出来后的 BUG

lzdyes avatar Mar 22 '26 11:03 lzdyes

同样的问题,重启容器后恢复了。但是用几次就又会出现

alfred-liu96 avatar Mar 25 '26 11:03 alfred-liu96

Started getting this today with Anthropic models

lockieluke avatar Mar 25 '26 13:03 lockieluke

会出现一个会话刚开始的有几次会不断报错

Image # 当第一个请求出现ai端报错时 cliproxyapi报错如下
HTTP/1.1 500 Internal Server Error
Server: openresty/1.29.2.1
Date: Sat, 21 Mar 2026 02:23:03 GMT
Content-Type: application/json
Content-Length: 105
Connection: keep-alive
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
Access-Control-Allow-Origin: *

{"error":{"message":"请求错误(状态码: 500)","type":"server_error","code":"internal_server_error"}}

远端报错如下

HTTP/2.0 500 Internal Server Error
date: Sat, 21 Mar 2026 02:23:03 GMT
content-type: text/plain; charset=utf-8
server: cloudflare
x-content-type-options: nosniff
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=4ov66RHzsAzxj%qweqwe%2F%qweqwe%3D%3D"}]}
cf-ray: 9df97dddff516864-NRT

请求错误(状态码: 500)

后续连续几个重试接口就一直报下面错误

HTTP/1.1 500 Internal Server Error
Server: openresty/1.29.2.1
Date: Sat, 21 Mar 2026 02:24:46 GMT
Content-Type: application/json
Content-Length: 112
Connection: keep-alive
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
Access-Control-Allow-Origin: *

{"error":{"message":"auth_unavailable: no auth available","type":"server_error","code":"internal_server_error"}}

token都是正确的


管理中心版本
dev
CLI Proxy API 版本

检查更新
v6.8.55
构建时间
2026/3/16 22:33:44

上游是什么模型?供应商是什么?

luispater avatar Mar 29 '26 08:03 luispater

@luispater I've investigated this issue and identified the root cause.

Root Cause:

When upstream (third-party API / Cloudflare gateway) returns HTTP 401, 402, 403, or 404 errors, MarkResult in conductor.go sets state.NextRetryAfter to 30 minutes (for 401/402/403) or 12 hours (for 404), and calls SuspendClientModel in the model registry.

The problem is that disable-cooling: true only suppresses cooldown for 429 and 5xx errors — it has no effect on 401/402/403/404. So when all credentials hit one of these errors (which is common with third-party APIs behind Cloudflare), every auth gets blocked and the scheduler returns auth_unavailable.

Additionally, the polluted ModelStates survive config hot-reloads because applyCoreAuthAddOrUpdate (service.go:291-292) inherits existing ModelStates when the new auth has none:

if len(auth.ModelStates) == 0 && len(existing.ModelStates) > 0 {
    auth.ModelStates = existing.ModelStates // polluted state inherited
}

This is why only a full restart clears the issue — it's the only way to reset the auth state completely.

Fix:

PR #2348 makes disable-cooling also cover 401/402/403/404 errors, so NextRetryAfter is cleared and model suspension is skipped when cooling is disabled. This keeps auths immediately available for the next request.

Workaround (before the fix is merged):

Build from the fix/disable-cooling-cover-all-errors branch and set disable-cooling: true in config.yaml.

Chanpoe avatar Mar 30 '26 18:03 Chanpoe

我在 6.9.20 中也遇到了相同的问题, 做了以下配置之后可以正常使用了。

  1. 认证;认证之后我好像重启了服务?
  2. 禁用冷却

bububear avatar Apr 10 '26 09:04 bububear