CC Switch local proxy failed while handling Codex endpoint /responses. Provider:...
错误信息
CC Switch local proxy failed while handling Codex endpoint /responses. Provider: DeepSeek; model: deepseek-v4-flash; upstream_status: HTTP 400; cause: Invalid schema for function 'codex_app__automation_update': schema must be a JSON Schema of 'type: "object"', got 'type: null'.
AI 解决方案
🔍 错误分析
1. 🌐 错误翻译
原文:CC Switch local proxy failed while handling Codex endpoint /responses. Provider: DeepSeek; model: deepseek-v4-flash; upstream_status: HTTP 400; cause: Invalid schema for function 'codex_app__automation_update': schema must be a JSON Schema of 'type: "object"', got 'type: null'.
译文:CC Switch本地代理在处理Codex端点/responses时失败。提供商:DeepSeek;模型:deepseek-v4-flash;上游状态:HTTP 400;原因:函数'codex_app__automation_update'的schema无效:schema必须是'type: "object"'的JSON Schema,但得到的是'type: null'。
2. 🎯 原因分析
codex_app__automation_update的JSON Schema中,type字段被设置为null,而API要求type必须是"object"3. 💡 解决方案
检查并修复函数schema定义,确保
type字段正确设置为"object":{
"name": "codex_app__automation_update",
"description": "自动化更新函数",
"parameters": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "记录ID"
},
"status": {
"type": "string",
"description": "状态"
}
},
"required": ["id", "status"]
}
}
如果你的代码中使用了函数调用相关参数,确保类似这样的定义正确:
// 修复后的正确调用示例
const functionCall = {
name: 'codex_app__automation_update',
arguments: {
id: '123',
status: 'active'
},
// 函数定义部分
functionDef: {
type: 'object', // 必须明确指定
properties: {
id: { type: 'string' },
status: { type: 'string' }
},
required: ['id', 'status']
}
};
4. 🛡️ 预防措施
type字段,避免使用null或未定义值,推荐使用TypeScript或JSDoc增强类型安全