{"record":{"id":"29b8f56e0568cbfb","repo":"jackwener/OpenCLI","slug":"wantmodel-model-requires-a-paid-claude-plan","errorCode":null,"errorMessage":"${wantModel} model requires a paid Claude plan.","messagePattern":"(.+?) model requires a paid Claude plan\\.","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/claude/ask.js","lineNumber":89,"sourceCode":"        // an existing conversation. Also avoid changing the user's current\n        // UI selection unless --model was explicitly passed.\n        const currentUrl = await page.evaluate('window.location.href') || '';\n        const inConversation = currentUrl.includes('/chat/');\n        const modelExplicit = kwargs.__opencliOptionSources?.model === 'cli';\n\n        const wantModel = kwargs.model || 'sonnet';\n        if (modelExplicit) {\n            if (inConversation) {\n                throw new ArgumentError(\n                    `Cannot switch to ${wantModel} model inside an existing conversation.`,\n                    'Re-run with --new to start a fresh chat before selecting a model.',\n                );\n            }\n\n            const modelResult = await withRetry(() => selectModel(page, wantModel));\n            if (!modelResult?.ok) {\n                if (modelResult?.upgrade) {\n                    throw new ArgumentError(\n                        `${wantModel} model requires a paid Claude plan.`,\n                        'Pick --model sonnet or --model haiku, or upgrade your account.',\n                    );\n                }\n                throw new CommandExecutionError(`Could not switch to ${wantModel} model`);\n            }\n            // Post-toggle settle dropped — the next CDP eval (setAdaptiveThinking) gives\n            // React enough time to flush aria-checked updates between rountrips.\n        }\n\n        const thinkResult = await withRetry(() => setAdaptiveThinking(page, wantThink));\n        if (!thinkResult?.ok && wantThink) {\n            throw new CommandExecutionError('Could not enable Adaptive thinking');\n        }\n        // Post-toggle settle dropped — the next CDP eval (sendMessage / sendWithFile)\n        // gives React enough time to flush aria-checked updates.\n\n        if (kwargs.file) {","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/claude/ask.js#L71-L107","documentation":"selectModel() reported the requested model is gated behind a paid plan (modelResult.upgrade). The library converts that into an ArgumentError telling the user the chosen model (e.g. opus) requires a paid Claude subscription and suggesting sonnet or haiku instead.","triggerScenarios":"Passing --model opus (or another premium model) on a free Claude account; selectModel detects the plan-gated state and returns {ok:false, upgrade:true} after withRetry.","commonSituations":"Free-tier account selecting opus; workspace with restricted plan settings; enterprise account where the chosen model is not provisioned.","solutions":["Use --model sonnet or --model haiku which are available on free plans.","Upgrade the Claude account to a paid plan that includes the requested model.","Check the account's plan/workspace settings if a paid plan should include the model."],"exampleFix":"// before\nopencli claude ask \"hi\" --model opus   # free plan\n// after\nopencli claude ask \"hi\" --model haiku","handlingStrategy":"validation","validationCode":"// Know your plan; default to free-tier models\nconst allowedModels = ['sonnet', 'haiku']; // free plan\nif (opts.model && !allowedModels.includes(opts.model)) {\n  console.warn(`model ${opts.model} needs a paid plan; falling back`);\n  opts.model = 'sonnet';\n}","typeGuard":null,"tryCatchPattern":"try {\n  await opencli.claude.ask(prompt, { model: 'opus' });\n} catch (e) {\n  if (/requires a paid Claude plan/.test(e.message)) {\n    await opencli.claude.ask(prompt, { model: 'sonnet' });\n  } else throw e;\n}","preventionTips":["Use sonnet/haiku unless you know the account has opus access.","Verify plan entitlements before scripting premium models.","Handle the upgrade hint programmatically by falling back to a cheaper model."],"tags":["permissions","billing","model-selection"],"backgroundTag":"plan-upgrade-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}