zai-org / zai-org/feedback

[Bug] CLI 0.16.5 (Desktop 3.12.3) headless --prompt: ProviderBusinessError 404 NOT_FOUND — headless picks openai-kind provider but hits /api/anthropic

Open
#693 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

CLI 0.16.5 headless --promptProviderBusinessError: 404 NOT_FOUND:headless 会话选到 openai 渠道却请求 Anthropic 端点

环境

  • macOS 15.6 (arm64)
  • ZCode Desktop 3.12.3(2026-09-17 16:56 自动升级,此前为 3.11.x)
  • 内置 CLI:zcode 0.16.5,以 node /Applications/ZCode.app/Contents/Resources/glm/zcode.cjs --prompt "..." 方式调用(外部调度器 headless 派工,升级前每天在用)
  • 账号:GLM Coding Plan(bigmodel-individual-coding-plan),已登录;同版本 GUI 一切正常

复现

$ node /Applications/ZCode.app/Contents/Resources/glm/zcode.cjs --prompt "只回答:1+1=?"
ProviderBusinessError: 404 NOT_FOUND
    at detectProviderBusinessError (.../zcode.cjs:2052:10937)
    at async postToApi (.../zcode.cjs:2016:22167)
    at async dsi.doStream (.../zcode.cjs:2027:83401)

cwd 在 git 仓库内外结果相同。升级到 3.12.3 后所有 headless 派工全部失败。

日志证据

~/.zcode/cli/log/zcode-2026-09-17.jsonlmodel.request.failed(traceId 992e45da-d525-487f-94e6-96a4576977e8):

字段
providerId bigmodel-api
modelId GLM-5.3
providerKind openai
baseURL https://open.bigmodel.cn/api/anthropic
HTTP 500,body 404 NOT_FOUND

providerKind 是 openai,但 baseURL 是 Anthropic 协议端点(/api/anthropic 只接受 Anthropic Messages 协议)。请求协议与端点不匹配,必然 404。

同版本 GUI 正常

同一 3.12.3、同账号、同一 provider 注册表,GUI 会话用 account:bigmodel-individual-coding-plan 选择出话正常;只有 headless 会话选到 bigmodel-api

尝试过的绕过(均无效)

  1. 旧配置 ~/.zcode/cli/config.jsonmodel.main + provider.bigmodel(升级前 headless 实际使用的配置)不再被 0.16.5 headless 读取。
  2. ~/.zcode/v2/provider_config.jsonconfig.defaultModelSelection 设为 account:bigmodel-individual-coding-plan(GUI 实际使用的选择)→ headless 仍选 bigmodel-api,仍 404。
  3. ZCODE_BUILTIN_PROVIDER_BUNDLED_CONFIG_FILE / ZCODE_BUILTIN_PROVIDER_CONFIG_FILE / ZCODE_PERSONAL_PROVIDER_CONFIG_FILE 分别指向内置 Resources/config/provider/zcode-builtin.json 与用户配置:注册表能建起来、请求真的发出,但模型选择结果不变。
  4. --help 显示 headless 没有任何指定模型/provider 的参数,用户侧无法手动纠正。

期望

  • headless 会话与 GUI 遵守同一 defaultModelSelection;或给 --prompt 增加 --model / --provider 参数。
  • providerKind=openai 的 provider 不应被配上 /api/anthropic 这类 Anthropic 协议 baseURL。

附注(次要)

升级到 3.12.3 后还观察到过一次"无法定位 CLI ZCode Built-in Provider Config"(当时 cwd 在 git worktree 深层目录;内置配置实际打包在 Resources/config/provider/)。当前环境下该错误不再复现,但 provider 配置按 cwd 仓库布局逐级上溯的查找逻辑可能在某些目录结构下失配,一并提请检查。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with the Node command shown for zcode.cjs and inspect the model.request.failed entry in ~/.zcode/cli/log/zcode-2026-09-17.jsonl. Compare headless selection with config.defaultModelSelection in ~/.zcode/v2/provider_config.json and the provider files under Resources/config/provider/. Done means headless selects the same account as GUI or exposes a working provider/model override, without sending an OpenAI-kind request to /api/anthropic.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.