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'.
译文:在处理 Codex 端点 /responses 时,CC Switch 本地代理失败。提供商: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,而接口要求该字段必须是字符串 "object"。type 属性配置错误。3. 💡 解决方案
检查并修改函数
codex_app__automation_update 的 schema 配置,确保 type 字段正确设置为 "object",而非 null。以下是修复后的 schema 示例(以关键修复部分为例):{
"type": "object",
"properties": {
// 原有的属性配置保持不变
},
"required": ["关键必填字段"]
}
关键修复说明:将原配置中
type: null 改为 type: "object",确保符合 JSON Schema 规范和接口要求。4. 🛡️ 预防措施
type 字段的强制要求,使用工具(如 JSON Schema Validator)验证 schema 格式,避免类型配置错误。type 字段设置默认值(如默认 "object"),并添加前置校验,若 type 为空或不符合要求,直接抛出明确提示,提前阻断错误传递。