":."type"."<nil>","mesage"."Unexpected value(s) advisor-tooL2026-03-01 for the a...
错误信息
Claude Code retumed an eor result: AP! Eror: 400 "error":."type"."<nil>","mesage"."Unexpected value(s) advisor-tooL2026-03-01 for the anthropic beta header
Please consult our documentation at *** **.com/docs or try again without the header. (request id: 20260715105733713905394HViDPluh)(request id.
20260715025733528140864c14228f59Aq1D7GQ)"},"type":"error"}
AI 解决方案
🔴 报错分析
1. 🌐 错误翻译
原文:Claude Code returned an error result: API Error: 400 "error":."type"."<nil>","message"."Unexpected value(s) advisor-tool-2026-03-01 for the anthropic beta header
Please consult our documentation at *** **.com/docs or try again without the header. (request id: 20260715105733713905394HViDPluh)(request id.
20260715025733528140864c14228f59Aq1D7GQ)"},"type":"error"}
译文:Claude Code返回了错误结果:API错误:400 "error":."type"."<nil>","message"."anthropic beta 标头中出现了意外的值 advisor-tool-2026-03-01
请参阅我们的文档 *** **.com/docs 或尝试不带该标头重试。(请求ID: 20260715105733713905394HViDPluh)(请求ID.
20260715025733528140864c14228f59Aq1D7GQ)},"type":"error"}
2. 🎯 原因分析
anthropic-beta 标头传递了无效值 advisor-tool-2026-03-01,超出了API接受的范围anthropic-beta 字段3. 💡 解决方案
移除或修正
anthropic-beta 请求头,以下是修复后的代码示例:// 移除错误的 anthropic-beta 标头后的请求配置
const response = await fetch('https://api.anthropic.com/v1/messages', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
'X-API-Key': API_KEY,
// 移除或修正 anthropic-beta 标头
// 'anthropic-beta': 'advisor-tool-2026-03-01', // 错误行,注释或删除
},
body: JSON.stringify({
// 正常请求体内容
model: 'claude-3-5-sonnet-20241022',
messages: [...],
max_tokens: 1000,
}),
});
如果确实需要使用Beta功能,请查阅官方文档确认支持的合法值,示例修正:
// 使用合法的 anthropic-beta 值
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
'anthropic-beta': 'tool-use-20240822', // 替换为文档中认可的合法值
}