","message":"Error from provider(yinli,claude-sonnet-4-5-20250929-thinking: 400)...
🚨 错误信息
{"level":50,"time":1765040297364,"pid":187,"hostname":"RenfengdeMacBook-Air.local","reqId":"req-g","err":{"type":"Error","message":"Error from provider(yinli,claude-sonnet-4-5-20250929-thinking: 400): {\"error\":{\"type\":\"\\u003cnil\\u003e\",\"message\":\"{\\\"type\\\":\\\"error\\\",\\\"error\\\":{\\\"type\\\":\\\"invalid_request_error\\\",\\\"message\\\":\\\"tools.0: Input tag 'function' found using 'type' does not match any of the expected tags: 'bash_20250124', 'custom', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728', 'web_search_20250305'\\\"},\\\"request_id\\\":\\\"req_011CVqng5MNBPYKrZjbjBgnj\\\"}(traceid: 15f2c659ccae7e185fdb0d23f2f5cfa7) (request id: 20251207005816550951659KrbF7fnf) (request id: 20251207005816470295483dkigtDmo) (request id: 20251207005816290163220r2t6g8Qy)\"},\"type\":\"error\"}","stack":"Error: Error from provider(yinli,claude-sonnet-4-5-20250929-thinking: 400): {\"error\":{\"type\":\"\\u003cnil\\u003e\",\"message\":\"{\\\"type\\\":\\\"error\\\",\\\"error\\\":{\\\"type\\\":\\\"invalid_request_error\\\",\\\"message\\\":\\\"tools.0: Input tag 'function' found using 'type' does not match any of the expected tags: 'bash_20250124', 'custom', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728', 'web_search_20250305'\\\"},\\\"request_id\\\":\\\"req_011CVqng5MNBPYKrZjbjBgnj\\\"}(traceid: 15f2c659ccae7e185fdb0d23f2f5cfa7) (request id: 20251207005816550951659KrbF7fnf) (request id: 20251207005816470295483dkigtDmo) (request id: 20251207005816290163220r2t6g8Qy)\"},\"type\":\"error\"}\n at nt (/Users/renfenghuang/.nvm/versions/node/v22.17.1/lib/node_modules/@musistudio/claude-code-router/dist/cli.js:79940:11)\n at p0 (/Users/renfenghuang/.nvm/versions/node/v22.17.1/lib/node_modules/@musistudio/claude-code-router/dist/cli.js:80000:11)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async f0 (/Users/renfenghuang/.nvm/versions/node/v22.17.1/lib/node_modules/@musistudio/claude-code-router/dist/cli.js:79965:96)","statusCode":400,"code":"provider_response_error"},"msg":"Error from provider(yinli,claude-sonnet-4-5-20250929-thinking: 400): {\"error\":{\"type\":\"\\u003cnil\\u003e\",\"message\":\"{\\\"type\\\":\\\"error\\\",\\\"error\\\":{\\\"type\\\":\\\"invalid_request_error\\\",\\\"message\\\":\\\"tools.0: Input tag 'function' found using 'type' does not match any of the expected tags: 'bash_20250124', 'custom', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728', 'web_search_20250305'\\\"},\\\"request_id\\\":\\\"req_011CVqng5MNBPYKrZjbjBgnj\\\"}(traceid: 15f2c659ccae7e185fdb0d23f2f5cfa7) (request id: 20251207005816550951659KrbF7fnf) (request id: 20251207005816470295483dkigtDmo) (request id: 20251207005816290163220r2t6g8Qy)\"},\"type\":\"error\"}"}
🤖 AI解决方案
错误分析报告
1. 错误翻译
原文:tools.0: Input tag 'function' found using 'type' does not match any of the expected tags: 'bash_20250124', 'custom', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728', 'web_search_20250305'
译文:tools.0: 使用'type'找到的输入标签'function'与任何预期标签都不匹配:'bash_20250124', 'custom', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728', 'web_search_20250305'
2. 原因分析
- 根本原因:在调用Claude Sonnet 4.5模型时,传递了无效的tool类型参数
- 具体问题:代码中使用了
type: "function"作为工具类型,但该模型只支持特定的工具类型列表 - 错误位置:在tools数组的第一个元素(索引0)中
3. 解决方案
// 修复后的代码示例
const tools = [
{
type: "custom", // 使用支持的tool类型之一
// 其他必要的tool配置参数
name: "your_tool_name",
description: "Tool description"
}
// 或者根据需求选择其他支持的tool类型
];
// 支持的tool类型选项:
// - "bash_20250124"
// - "custom"
// - "text_editor_20250124"
// - "text_editor_20250429"
// - "text_editor_20250728"
// - "web_search_20250305"
4. ️ 预防措施
建议:检查Claude API文档中关于tool类型的详细说明,选择最适合您需求的tool类型进行替换。