thedotmack/claude-mem · error

Unknown Claude model

Error message

Unknown Claude model: ${options.model}. Allowed: ${[...allowed].join(', ')}

What it means

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.

Solutions

  1. Use one of the allowed model IDs exactly as listed in the error message (e.g. claude-opus-4-8).
  2. Configure gateway authentication (resolveClaudeAuthMethod() === 'gateway') if you need a custom model not on the allowlist.
  3. Check ~/.claude-mem/settings.json for a stale CLAUDE_MEM_MODEL value and correct it.

Example fix

// before
claude-mem install --model claude-sonnet-4-5-20250929
// after
claude-mem install --model claude-opus-4-8
Defensive patterns

Strategy: validation

Validate before calling

const allowed = new Set(['claude-opus-4-8' /* ... */]);
if (options.model && resolveClaudeAuthMethod() !== 'gateway' && !allowed.has(options.model)) {
  throw new Error(`Model ${options.model} not allowed without gateway auth; allowed: ${[...allowed].join(', ')}`);
}

Type guard

const isAllowedModel = (m: string, allowCustom: boolean): boolean => allowCustom || ALLOWED_MODELS.has(m);

Try / catch

try {
  await install({ model: userSuppliedModel });
} catch (e) {
  if (/Unknown Claude model/.test(String(e))) {
    console.error('Pick a model from the allowlist or enable gateway auth.');
  }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/512f6c95c5e6ba93. Report an issue: GitHub.

Appendix: source

Thrown at src/npx-cli/commands/install.ts:1256

    };
  const wrote = mergeSettings(updates);
  if (wrote) {
    log.info(`Saved provider=${selectedProvider} to ~/.claude-mem/settings.json`);
  }
  return selectedProvider;
}

async function promptClaudeModel(options: InstallOptions): Promise<void> {
  const allowed = new Set([
    'claude-haiku-4-5-20251001',
    'claude-sonnet-5',
    'claude-opus-4-8',
  ]);
  const allowCustomModel = resolveClaudeAuthMethod() === 'gateway';

  if (options.model && !allowCustomModel) {
    if (!allowed.has(options.model)) {
      throw new Error(
        `Unknown Claude model: ${options.model}. Allowed: ${[...allowed].join(', ')}`,
      );
    }
    const wrote = mergeSettings({ CLAUDE_MEM_MODEL: options.model });
    if (wrote) {
      log.info(`Saved Claude model=${options.model} to ~/.claude-mem/settings.json`);
    }
    return;
  }
  if (options.model && allowCustomModel) {
    const wrote = mergeSettings({ CLAUDE_MEM_MODEL: options.model });
    if (wrote) {
      log.info(`Saved gateway model=${options.model} to ~/.claude-mem/settings.json`);
    }
    return;
  }

  if (!isInteractive) return;

View on GitHub (pinned to d8bc9755e7)