{"record":{"id":"512f6c95c5e6ba93","repo":"thedotmack/claude-mem","slug":"unknown-claude-model-options-model-allowed","errorCode":null,"errorMessage":"Unknown Claude model: ${options.model}. Allowed: ${[...allowed].join(', ')}","messagePattern":"Unknown Claude model: (.+?)\\. Allowed: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/npx-cli/commands/install.ts","lineNumber":1256,"sourceCode":"    };\n  const wrote = mergeSettings(updates);\n  if (wrote) {\n    log.info(`Saved provider=${selectedProvider} to ~/.claude-mem/settings.json`);\n  }\n  return selectedProvider;\n}\n\nasync function promptClaudeModel(options: InstallOptions): Promise<void> {\n  const allowed = new Set([\n    'claude-haiku-4-5-20251001',\n    'claude-sonnet-5',\n    'claude-opus-4-8',\n  ]);\n  const allowCustomModel = resolveClaudeAuthMethod() === 'gateway';\n\n  if (options.model && !allowCustomModel) {\n    if (!allowed.has(options.model)) {\n      throw new Error(\n        `Unknown Claude model: ${options.model}. Allowed: ${[...allowed].join(', ')}`,\n      );\n    }\n    const wrote = mergeSettings({ CLAUDE_MEM_MODEL: options.model });\n    if (wrote) {\n      log.info(`Saved Claude model=${options.model} to ~/.claude-mem/settings.json`);\n    }\n    return;\n  }\n  if (options.model && allowCustomModel) {\n    const wrote = mergeSettings({ CLAUDE_MEM_MODEL: options.model });\n    if (wrote) {\n      log.info(`Saved gateway model=${options.model} to ~/.claude-mem/settings.json`);\n    }\n    return;\n  }\n\n  if (!isInteractive) return;","sourceCodeStart":1238,"sourceCodeEnd":1274,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/npx-cli/commands/install.ts#L1238-L1274","documentation":"The installer validates a user-supplied model name against a hard-coded allowlist of Claude models, and only permits arbitrary custom models when auth resolves to the 'gateway' method. If a non-allowlisted model is passed without gateway auth, install aborts immediately with the allowed list enumerated in the message.","triggerScenarios":"Running the install command with a --model (options.model) value that is not in the allowed set while resolveClaudeAuthMethod() returns something other than 'gateway' (e.g. API-key or subscription auth).","commonSituations":"Typo in the model ID (e.g. 'claude-opus-4' vs 'claude-opus-4-8'), copying a model name from Anthropic docs that the plugin hasn't allowlisted yet, or expecting custom-model support outside gateway mode.","solutions":["Use one of the allowed model IDs exactly as listed in the error message (e.g. claude-opus-4-8).","Configure gateway authentication (resolveClaudeAuthMethod() === 'gateway') if you need a custom model not on the allowlist.","Check ~/.claude-mem/settings.json for a stale CLAUDE_MEM_MODEL value and correct it."],"exampleFix":"// before\nclaude-mem install --model claude-sonnet-4-5-20250929\n// after\nclaude-mem install --model claude-opus-4-8","handlingStrategy":"validation","validationCode":"const allowed = new Set(['claude-opus-4-8' /* ... */]);\nif (options.model && resolveClaudeAuthMethod() !== 'gateway' && !allowed.has(options.model)) {\n  throw new Error(`Model ${options.model} not allowed without gateway auth; allowed: ${[...allowed].join(', ')}`);\n}","typeGuard":"const isAllowedModel = (m: string, allowCustom: boolean): boolean => allowCustom || ALLOWED_MODELS.has(m);","tryCatchPattern":"try {\n  await install({ model: userSuppliedModel });\n} catch (e) {\n  if (/Unknown Claude model/.test(String(e))) {\n    console.error('Pick a model from the allowlist or enable gateway auth.');\n  }\n}","preventionTips":["Keep a shared constant of allowed model IDs and validate CLI flags against it at parse time.","Only surface --model in help text when gateway auth is active.","Store model choice in settings and validate it on read, not just on write."],"tags":["cli","model-validation","config"],"backgroundTag":"invalid-enum-value","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}