CC Switch local proxy failed while handling Codex endpoint /responses. Provider:...

2026年07月13日 16:45 22.95 秒 success

错误信息

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. 🎯 原因分析


  • 根本原因:在调用 DeepSeek 模型的 codex_app__automation_update 函数时,传入的参数 schema 不符合 JSON Schema 规范

  • 具体问题:schema 中 type 字段的值被设置为 null,而要求必须是 "object"

  • 错误位置:函数调用时定义的参数校验 schema 配置错误,导致上游 API 拒绝请求
  • 3. 💡 解决方案


    需要检查并修正函数 codex_app__automation_update 的 schema 定义,确保 type 字段正确设置为 "object",示例修复如下:

    {
      "type": "object",
      "properties": {
        // 这里填写函数实际需要的参数
        "param1": {
          "type": "string"
        },
        "param2": {
          "type": "number"
        }
        // 其他参数...
      },
      "required": ["param1"] // 根据实际需求配置必选参数
    }
    

    修正步骤

  • 定位到函数 codex_app__automation_update 的 schema 定义代码

  • 将 schema 的 type 字段从 null 改为 "object"

  • 根据函数实际参数需求,补充 propertiesrequired 配置
  • 4. 🛡️ 预防措施


  • ✅ 编写 JSON Schema 时,先明确参数类型,通过工具(如 JSON Schema Validator)校验格式正确性后再集成

  • ✅ 调用第三方模型函数前,仔细核对官方文档中函数的参数要求,确保 schema 与要求完全匹配

  • ✅ 推荐使用 VS Code 等带 JSON 校验功能的编辑器,实时检测 schema 格式问题,提前发现错误