{"record":{"id":"50b93ce5b2eab9f1","repo":"jackwener/OpenCLI","slug":"unknown-chatgpt-model-model","errorCode":null,"errorMessage":"Unknown ChatGPT model \"${model}\"","messagePattern":"Unknown ChatGPT model \"(.+?)\"","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/chatgpt/utils.js","lineNumber":383,"sourceCode":"        throw new AuthRequiredError(CHATGPT_DOMAIN, message);\n    }\n    return state;\n}\n\nexport async function ensureChatGPTComposer(page, message = 'ChatGPT composer is not available on the current page.') {\n    const state = await ensureChatGPTLogin(page, message);\n    if (!state.hasComposer) {\n        throw new CommandExecutionError(message);\n    }\n    return state;\n}\n\nfunction requireKnownChatGPTModel(model) {\n    const key = String(model ?? '').trim().toLowerCase();\n    const targetKey = CHATGPT_MODEL_ALIASES[key] || key;\n    const option = CHATGPT_MODEL_TARGETS[targetKey];\n    if (!option) {\n        throw new ArgumentError(\n            `Unknown ChatGPT model \"${model}\"`,\n            `Choose one of: ${CHATGPT_MODEL_CHOICES.join(', ')}`,\n        );\n    }\n    return { key: targetKey, alias: key !== targetKey ? key : null, ...option };\n}\n\nfunction requireKnownChatGPTTool(tool) {\n    const key = String(tool ?? '').trim().toLowerCase();\n    const option = CHATGPT_TOOL_OPTIONS[key];\n    if (!option) {\n        throw new ArgumentError(\n            `Unknown ChatGPT tool \"${tool}\"`,\n            `Choose one of: ${CHATGPT_TOOL_CHOICES.join(', ')}`,\n        );\n    }\n    return { key, ...option };\n}","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/chatgpt/utils.js#L365-L401","documentation":"requireKnownChatGPTModel validates the requested model name against CHATGPT_MODEL_TARGETS/CHATGPT_MODEL_ALIASES and throws ArgumentError when nothing matches. Aliases are normalized (trimmed, lowercased) before lookup, so only genuinely unknown names fail. The error's suggestion lists every accepted choice.","triggerScenarios":"Passing a model argument like `--model gpt-4o` or `--model opus` to a ChatGPT command whose `target` path resolves through requireKnownChatGPTModel; any spelling not in the fast/balanced/advanced/very-high/gpt-5.6-pro/pro alias table (e.g. 'GPT-5.5', '5', 'thinking-pro').","commonSituations":"Copying model names from another tool (OpenAI API ids like gpt-4o or o3); stale docs listing retired model names after ChatGPT renamed tiers; script config files carrying old model keys.","solutions":["Run with one of the listed choices: fast, balanced, advanced, very-high, gpt-5.6-pro, pro (or aliases like high/thinking, medium, ultra, speed/instant).","Lowercase and trim your value — lookup is case-insensitive but the word must match exactly.","Map any OpenAI-API-style model id to the closest ChatGPT tier in your config (e.g. gpt-4o -> balanced).","Update the library if ChatGPT introduced a new model tier this version doesn't know yet."],"exampleFix":"// before\nconst target = await chatgpt.model({ model: 'gpt-4o' }); // ArgumentError\n// after\nconst target = await chatgpt.model({ model: 'balanced' }); // accepted choice","handlingStrategy":"validation","validationCode":"import { CHATGPT_MODEL_CHOICES } from '@jackwener/opencli/chatgpt/utils';\nconst key = String(model ?? '').trim().toLowerCase();\nif (!CHATGPT_MODEL_CHOICES.includes(key)) {\n  throw new Error(`model must be one of: ${CHATGPT_MODEL_CHOICES.join(', ')}`);\n}","typeGuard":"function isKnownChatGPTModel(model, choices) {\n  return typeof model === 'string' && choices.map(c => c.toLowerCase()).includes(model.trim().toLowerCase());\n}","tryCatchPattern":"try {\n  await selectChatGPTModel(page, model);\n} catch (err) {\n  if (err instanceof ArgumentError && /Unknown ChatGPT model/.test(err.message)) {\n    console.error(err.suggestion ?? err.message);\n  }\n  throw err;\n}","preventionTips":["Read choices from CHATGPT_MODEL_CHOICES instead of hardcoding model names.","Validate CLI/config inputs against the exported choice list before invoking commands.","Treat aliases (speed, medium, high, thinking, ultra) as the only accepted synonyms.","Keep configs in sync when upgrading the library, since model tiers change."],"tags":["validation","argument-error","chatgpt","model-name"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}