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,而接口要求必须是 "object"。3. 💡 解决方案
检查函数
codex_app__automation_update 的 schema 定义,确保 type 字段明确设置为 "object",并修复可能的 null 值问题。以下是修复后的示例:{
"type": "object",
"properties": {
// 其他参数定义...
},
"required": ["必要参数名"]
}
若你正在通过代码动态生成 schema,修复代码中的 schema 构造逻辑,例如(以JavaScript为例):
// 修复前可能的错误构造方式
const invalidSchema = {
type: null, // 错误:type 不能为 null
properties: { /* ... */ }
};
// 修复后
const validSchema = {
type: "object", // 正确:明确设置为 "object"
properties: { /* ... */ }
};
4. 🛡️ 预防措施
type)的类型和值,禁止传入 null、undefined 等非法值,推荐使用 TypeScript 或运行时校验工具(如 ajv)进行强类型约束。