can1357/oh-my-pi · error · Error
Smithery API key not found after login.
Error message
Smithery API key not found after login.
What it means
Thrown by #requireSmitheryApiKey when the login flow reported success (#promptSmitheryLogin returned true) but a subsequent getSmitheryApiKey() still returns nothing — i.e. the key was not actually persisted despite the login reporting completion. This indicates an inconsistency between the login result and credential storage.
Source
Thrown at packages/coding-agent/src/modes/controllers/mcp-command-controller.ts:2498
return undefined;
}
#toSmitheryAuthReason(status: number): string {
return status === 429 ? "rate limited by Smithery" : "forbidden/unauthorized with Smithery";
}
async #requireSmitheryApiKey(reason: string): Promise<string> {
let apiKey = await getSmitheryApiKey();
if (apiKey) return apiKey;
const loggedIn = await this.#promptSmitheryLogin(reason);
if (!loggedIn) {
throw new Error("Smithery login cancelled. Run /mcp smithery-login, then retry /mcp smithery-search.");
}
apiKey = await getSmitheryApiKey();
if (!apiKey) {
throw new Error("Smithery API key not found after login.");
}
return apiKey;
}
async #runSmitheryOperationWithAuthRetry<T>(operation: (apiKey: string) => Promise<T>, reason: string): Promise<T> {
const apiKey = await this.#requireSmitheryApiKey(reason);
try {
return await operation(apiKey);
} catch (error) {
const status = this.#getSmitheryErrorStatus(error);
if (status === undefined || ![401, 403, 429].includes(status)) {
throw error;
}
const loggedIn = await this.#promptSmitheryLogin(this.#toSmitheryAuthReason(status));
if (!loggedIn) {
throw error;
}
const retryApiKey = await this.#requireSmitheryApiKey(reason);View on GitHub (pinned to 9690622007)
Solutions
- Re-run /mcp smithery-login; if it succeeds again and the error repeats, the key save is failing — check write permissions on your OMP config/credentials location.
- Verify no second OMP instance is running that might race the key store; close others and retry.
- As a workaround, check for errors in the OMP log (~/.omp/logs/) around the save and fix the underlying storage issue (permissions, disk space).
- If storage remains broken, report the persistence failure — the login path should have surfaced the save error instead of reporting success.
Defensive patterns
Strategy: validation
Validate before calling
const key = await getSmitheryApiKey();
if (!key) {
// storage read returned nothing — check the credentials file is readable before blaming the login
console.error("Smithery key missing from store; check config dir permissions/disk space.");
} Type guard
function isPostLoginKeyMissing(err: unknown): err is Error {
return err instanceof Error && err.message === "Smithery API key not found after login.";
} Try / catch
try {
await smitherySearch(query);
} catch (err) {
if (isPostLoginKeyMissing(err)) {
// login 'succeeded' but persistence failed: re-login and watch for save errors
await smitheryLogin();
} else throw err;
} Prevention
- Keep the OMP config/credentials location writable (check permissions and free disk space).
- Avoid running multiple OMP instances concurrently during login to prevent key-store races.
- After a successful login, verify the key persisted (the status message 'Smithery API key saved.') before issuing dependent commands.
- Inspect ~/.omp/logs/ for silent write failures if the error recurs.
When it happens
Trigger: Browser login flow completes (#handleSmitheryBrowserLogin validated and saved the key) or the API-key path returns true, yet getSmitheryApiKey() finds no stored key afterwards — e.g. a storage write failure silently swallowed, a race where another claim overwrote/cleared the key, or the storage file became unreadable between save and read.
Common situations: Permission problems on the config/credentials file preventing the save; concurrent OMP sessions racing on the key store; a keyring/OS credential store failure that the save path did not surface; disk-full conditions.
Related errors
- Smithery API key cannot be empty.
- Smithery search failed with status ${response.status}
- Smithery login cancelled. Run /mcp smithery-login, then retr
- Persistent credential block store ${store} is unavailable af
- Credential ${id} is not OAuth (provider=${provider}, type=${
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/126334aa739a473c.
Report an issue: GitHub.