thedotmack/claude-mem · error
Non-interactive ${providerLabel} configuration is missing a
Error message
Non-interactive ${providerLabel} configuration is missing a personal API key. What it means
Providers other than 'cmem' and 'claude' (i.e. bring-your-own-key providers) need a personal API key. In non-interactive mode there is no password prompt to collect one, so if the key has not already been provided/staged the install throws this error naming the provider.
Source
Thrown at src/npx-cli/commands/install.ts:1190
const providerLabel = selectedProvider === 'gemini' ? 'Gemini' : 'OpenRouter';
const keyEnvName = selectedProvider === 'gemini'
? 'CLAUDE_MEM_GEMINI_API_KEY'
: 'CLAUDE_MEM_OPENROUTER_API_KEY';
const existingKey = getSetting(keyEnvName as keyof SettingsDefaults) as string | undefined;
const existingOpenRouterBaseUrl = selectedProvider === 'openrouter'
? String(getSetting('CLAUDE_MEM_OPENROUTER_BASE_URL') ?? '')
: '';
const existingKeyIsCmem = selectedProvider === 'openrouter'
&& isCmemGatewayUrl(existingOpenRouterBaseUrl);
if (existingKey && existingKey.trim().length > 0 && !existingKeyIsCmem) {
const wrote = mergeSettings({ CLAUDE_MEM_PROVIDER: selectedProvider });
if (wrote) log.info(`Saved provider=${selectedProvider} to ~/.claude-mem/settings.json`);
return selectedProvider;
}
if (!isInteractive) {
throw new Error(`Non-interactive ${providerLabel} configuration is missing a personal API key.`);
}
const apiKeyResult = await p.password({
message: `Paste your ${providerLabel} API key:`,
mask: '*',
validate: (v?: string) => (!v || v.trim().length === 0) ? 'API key required' : undefined,
});
if (p.isCancel(apiKeyResult)) {
log.warn(`API key prompt cancelled — falling back to Claude provider.`);
persistClaudeProvider();
return 'claude';
}
const apiKey = String(apiKeyResult).trim();
const updates = selectedProvider === 'openrouter'
? buildPersonalOpenRouterSettings(
apiKey,View on GitHub (pinned to 8bc631a71a)
Solutions
- Provide the API key non-interactively (e.g. export the provider's key env var or put it in ~/.claude-mem/settings.json) and rerun install
- Run the installer in an interactive terminal so it can prompt: 'Paste your <provider> API key:'
- Switch to a provider that does not need a personal key (e.g. --provider claude) for non-interactive installs
Example fix
// before npx claude-mem install --provider grok-bot < /dev/null // after export GROKBOT_API_KEY=xai-... npx claude-mem install --provider grok-bot < /dev/null
Defensive patterns
Strategy: validation
Validate before calling
const needsKey = provider !== 'claude' && provider !== 'cmem';
if (needsKey && !process.stdin.isTTY && !hasStoredApiKey(provider)) {
throw new Error(`Provide an API key for ${provider} before non-interactive install`);
} Try / catch
try {
await runInstall({ provider });
} catch (e) {
if (e.message.includes('is missing a personal API key')) {
console.error(`Set the ${provider} API key in settings/env, or run interactively.`);
} else throw e;
} Prevention
- Stage the provider's API key in ~/.claude-mem/settings.json or the env before scripted installs
- Run install interactively the first time to store the key, then automate safely
- Verify key presence in settings before CI install steps
When it happens
Trigger: Running the installer non-interactively with a BYOK provider selected (options.provider set to e.g. 'openrouter'-style provider) and no API key supplied through settings/env or prior configuration, while isInteractive is false.
Common situations: CI/automation installing claude-mem with a custom provider but forgetting to stage the API key; key removed from ~/.claude-mem/settings.json; rerunning install after clearing credentials.
Understand the failure class
Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.
Related errors
- Provider=${options.provider} requested non-interactively. AP
- API key prompt cancelled — leaving existing configuration un
- missing_api_key
- Skipping local hook API key bootstrap: CLAUDE_MEM_SERVER_DAT
- Non-interactive provider validation did not run.
AI-assisted analysis of thedotmack/claude-mem@8bc631a71a (2026-09-09).
Data as JSON: /api/errors/39b3e2c588afd89b.
Report an issue: GitHub.