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

2026年08月25日 16:42 65.41 秒 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'.
译文:在处理 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"

  • 错误位置:函数定义中的 schema 配置部分,具体是 type 属性配置错误。

  • 上下文:该问题发生在通过 DeepSeek 的 deepseek-v4-flash 模型调用 Codex 接口时,因 schema 验证失败导致上游返回 HTTP 400 错误,进而引发代理失败。
  • 3. 💡 解决方案


    检查并修改函数 codex_app__automation_update 的 schema 配置,确保 type 字段正确设置为 "object",而非 null。以下是修复后的 schema 示例(以关键修复部分为例):

    {
      "type": "object",
      "properties": {
        // 原有的属性配置保持不变
      },
      "required": ["关键必填字段"]
    }
    

    关键修复说明:将原配置中 type: null 改为 type: "object",确保符合 JSON Schema 规范和接口要求。

    4. 🛡️ 预防措施


  • 严格校验 schema 类型:编写函数 schema 时,提前确认接口对 type 字段的强制要求,使用工具(如 JSON Schema Validator)验证 schema 格式,避免类型配置错误。

  • 配置默认值与校验机制:在代码中为 schema 的 type 字段设置默认值(如默认 "object"),并添加前置校验,若 type 为空或不符合要求,直接抛出明确提示,提前阻断错误传递。