thedotmack/claude-mem · warning
API key prompt cancelled — falling back to Claude provider.
Error message
API key prompt cancelled — falling back to Claude provider.
What it means
In the interactive provider-setup flow, if the user cancels (Ctrl-C / Esc) the masked API key prompt, the installer does not abort. Instead it warns, persists the default 'claude' provider via persistClaudeProvider(), and returns 'claude' as the selected provider.
Solutions
- Rerun `npx claude-mem install` (or the provider setup) and paste the API key when prompted.
- Accept the Claude provider fallback if you want to use Anthropic via Claude subscription instead of a custom key.
- Manually update the provider settings (e.g. via claude-mem settings) later once the key is available.
Defensive patterns
Strategy: fallback
Validate before calling
if (!process.stdin.isTTY) {
console.warn('API key prompt requires a TTY; provider will fall back to claude.');
} Prevention
- Have the provider API key ready in your clipboard before starting install.
- Run the installer in a real interactive terminal, not a piped/non-TTY context.
- Avoid pressing Esc/Ctrl-C at the masked prompt; to change provider later, rerun setup or edit settings.
When it happens
Trigger: User selects a BYO-key provider (OpenRouter, etc.), is shown the `message: 'Paste your <provider> API key:'` prompt, and cancels it via p.isCancel — non-TTY or interrupt.
Common situations: User doesn't have the key handy and presses Esc/Ctrl-C; aborted prompt in a partially automated terminal; accidental interrupt.
Related errors
- Failed to bootstrap server API key
- Provider= requested non-interactively. API key prompt…
- Select exactly one provider.
- API key prompt cancelled — leaving existing configuration…
- auth_invalid
AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17).
Data as JSON: /api/errors/695e246792e32c6e.
Report an issue: GitHub.
Appendix: source
Thrown at src/npx-cli/commands/install.ts:1223
&& 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,
readPersistedInstallerSettings(),
SettingsDefaultsManager.getAllDefaults().CLAUDE_MEM_OPENROUTER_MODEL,
)
: {
CLAUDE_MEM_PROVIDER: selectedProvider,
[keyEnvName]: apiKey,
};
const wrote = mergeSettings(updates);
if (wrote) {
log.info(`Saved provider=${selectedProvider} to ~/.claude-mem/settings.json`);View on GitHub (pinned to d8bc9755e7)