BigPizzaV3/CodexPlusPlus · error · Error
请填写 API 的模型名称
Error message
请填写 API 的模型名称
What it means
apiConfig() validates the external-channel API settings before use. When channel is 'external', the model name must be non-empty and at most 200 characters; otherwise this Error is thrown to stop the organize flow early with a clear message instead of sending a doomed request.
Solutions
- Open settings and enter a valid model name in the model field
- Verify the channel is really 'external' and the model matches what the provider exposes (e.g. gpt-4o, deepseek-chat)
- Ensure the model string is ≤200 characters (no accidental giant paste)
- If using native channel intentionally, set channel to 'native' so the model check is skipped
Example fix
// before
apiConfig({channel:'external',baseUrl:'https://api.x.com/v1',model:'',key:'sk-...'})
// after
apiConfig({channel:'external',baseUrl:'https://api.x.com/v1',model:'gpt-4o',key:'sk-...'}) Defensive patterns
Strategy: validation
Validate before calling
const model=(input.model||'').trim();
if(input.channel==='external' && (!model || model.length>200)) throw new Error('请填写 API 的模型名称'); Type guard
function hasValidModel(cfg){return typeof cfg?.model==='string' && cfg.model.trim().length>0 && cfg.model.trim().length<=200;} Prevention
- Always fill the model field when using an external channel
- Trim pasted model names
- Keep model names short and canonical from provider docs
When it happens
Trigger: Calling apiConfig (via the organize/save settings path) with input.channel==='external' and input.model empty or whitespace-only, or a model string longer than 200 chars.
Common situations: User selected external API channel in settings but left the model field blank; pasted a baseUrl+key but forgot model; a script/UI bug trimmed the model away.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Backups must be outside the cache
- Codex CLI 路径指向的是目录而不是可执行文件:
- Codex CLI 路径不存在: 请填 Codex CLI 可执行文件的完整路径。macOS 桌面版通常在…
- 请输入完整的 HTTPS API 地址
- 主题包必须是 32 MiB 以内的普通 ZIP 文件
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/37f04c9908c29591.
Report an issue: GitHub.
Appendix: source
Thrown at tools/conversation-canvas/public/canvas.user.js:634
await new Promise(resolve=>setTimeout(resolve,1000));
}
}
// OpenAI-compatible Chat Completions. Never persist credentials in tree checkpoints.
function apiEndpoint(raw){
let url;try{url=new URL(String(raw).trim());}catch{throw Error('请输入完整的 HTTPS API 地址');}
if(url.protocol!=='https:'||url.username||url.password||url.search||url.hash)throw Error('API 地址须使用 HTTPS,且不含账号、密码、查询参数或片段');
const path=url.pathname.replace(/\/+$/,'');
url.pathname=path.endsWith('/chat/completions')?path:(path||'/v1')+'/chat/completions';
return url.href;
}
function apiConfig(input){
const channel=input?.channel==='external'?'external':'native';
const value={channel,baseUrl:String(input?.baseUrl||'').trim(),model:String(input?.model||'').trim(),key:String(input?.key||'').trim(),remember:input?.remember===true,speed:input?.speed==='provider'?'provider':'fast',revision:input?.revision||crypto.randomUUID()};
if(channel==='external'){
value.endpoint=apiEndpoint(value.baseUrl);
if(!value.model||value.model.length>200)throw Error('请填写 API 的模型名称');
if(!value.key||/[\r\n]/.test(value.key))throw Error('请在设置中填写有效 API Key');
}
return value;
}
function storedApiConfig(config){
const {channel,baseUrl,model,remember,speed,revision}=config;
return {channel,baseUrl,model,remember,speed,revision,...remember?{key:config.key}:{}};
}
function apiError(error){
if(error?.name==='AbortError')return error;
if(error?.canvasApiLocal===true)return error;
const code=Number(error?.status??error?.responseStatus);
const hint={401:'密钥无效或已过期',403:'接口拒绝访问,请检查权限',404:'地址或模型不存在',408:'接口请求超时',413:'本批资料超过接口大小限制',429:'接口限流或额度不足'}[code];
// Provider messages can echo request contents and Authorization; never display them.
return Object.assign(Error(hint?`API ${code}:${hint}`:code>=400?`API 请求失败(HTTP ${code}),请检查服务状态`:'API 连接失败,请检查地址、网络及服务状态'),{retryable:!code||code===408||code===429||code>=500});
}View on GitHub (pinned to b1ed92e5e4)