+
Skip to content

Claude Code settings.json validation fails when using z.ai API, even with minimal configuration #75

@fred460

Description

@fred460

System Info / 系統信息

Environment

Platform: z.ai API (not Anthropic API)
Claude Code Version: v1.0.120
Operating System: Windows

Who can help? / 谁可以帮助到您?

No response

Information / 问题信息

  • The official example scripts / 官方的示例脚本
  • My own modified scripts / 我自己修改的脚本和任务

Reproduction / 复现过程

1.export ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
export ANTHROPIC_AUTH_TOKEN=your_zai_api_token_here
2.Create settings.json with hooks
Create ~/.claude/settings.json with valid hook configuration:
{
"hooks": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "echo 'File modified'"
}
]
}
]
}
3.claude /status
⚠ Found invalid settings files: .claude\settings.json. They will be ignored.

Expected behavior / 期待表现

Bug Description
When using Claude Code with z.ai API instead of Anthropic's official API, the settings validation system incorrectly flags valid settings.json files as invalid, causing them to be ignored. This affects both hook configurations and environment variables.

Current Behavior
With z.ai + hooks configuration:
bashclaude /status
Results in:
⚠ Found invalid settings files: .claude\settings.json. They will be ignored.

With z.ai + minimal env configuration:
Even with just basic environment configuration:
json{
"env": {
"ANTHROPIC_MODEL": "glm-4.5"
}
}
Still produces the same validation error.
Workaround that "works":

Empty settings.json file: No validation errors, but hooks don't work
With Anthropic API: Same settings file works perfectly

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载