CC Switch local proxy failed while handling Codex endpoint /responses. Provider:...
错误信息
CC Switch local proxy failed while handling Codex endpoint /responses. Provider: DMXAPI; model: gpt-5.6-terra; upstream_status: HTTP 400; cause: Invalid 'input[37].content': array too long. Expected an array with maximum length 0, but got an array with length 1 instead.
AI 解决方案
🔍 报错分析
1. 🌐 错误翻译
原文:CC Switch local proxy failed while handling Codex endpoint /responses. Provider: DMXAPI; model: gpt-5.6-terra; upstream_status: HTTP 400; cause: Invalid 'input[37].content': array too long. Expected an array with maximum length 0, but got an array with length 1 instead.
译文:在处理Codex端点/responses时,CC Switch本地代理失败。提供商:DMXAPI;模型:gpt-5.6-terra;上游状态:HTTP 400;原因:无效的'input[37].content':数组过长。预期最大长度为0的数组,但得到的数组长度为1。
2. 🎯 原因分析
该错误的核心原因是向模型API发送的请求参数不符合要求:
input[37].content 字段3. 💡 解决方案
需检查请求构造代码,定位
input数组中索引为37的元素,移除其content字段中的非空数据,确保该字段符合长度要求。以下是修复示例:// 假设原请求参数构造代码(存在问题)
const originalInput = /* 包含input[37].content为长度1数组的完整输入 */;
// 修复后的请求参数构造代码
const fixedInput = originalInput.map((item, index) => {
// 仅处理索引为37的元素,确保其content为长度0的数组
if (index === 37) {
return {
...item,
// 强制设置为空数组,满足最大长度0的要求
content: []
};
}
return item;
});
// 使用修复后的fixedInput构造请求体
const response = await fetch('/responses', {
method: 'POST',
body: JSON.stringify({ input: fixedInput }),
headers: { 'Content-Type': 'application/json' }
});