{"record":{"id":"ac76885e97c62530","repo":"musistudio/claude-code-router","slug":"local-agent-account-credential-was-not-found-sign","errorCode":null,"errorMessage":"Local agent account credential was not found. Sign in again, then re-import the local login provider.","messagePattern":"Local agent account credential was not found\\. Sign in again, then re-import the local login provider\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/providers/account-service.ts","lineNumber":1450,"sourceCode":"    id: readString(value.id),\n    label: readString(value.label),\n    redeemable: readBoolean(value.redeemable),\n    status: readString(value.status)\n  };\n  return detail.description || detail.effectiveAt || detail.expiresAt || detail.id || detail.label || detail.redeemable !== undefined || detail.status ? detail : undefined;\n}\n\nasync function materializeProviderAccountRequest(\n  config: AppConfig,\n  provider: GatewayProviderConfig\n): Promise<MaterializedProviderAccountRequest> {\n  if (providerApiKey(provider) !== localAgentProviderApiKey) {\n    return { provider };\n  }\n\n  const credential = await localAgentProviderAccountCredential(config, provider);\n  if (!credential?.apiKey) {\n    throw new Error(\"Local agent account credential was not found. Sign in again, then re-import the local login provider.\");\n  }\n\n  return {\n    headers: credential.headers,\n    provider: {\n      ...provider,\n      api_key: credential.apiKey,\n      apiKey: undefined,\n      apikey: undefined\n    }\n  };\n}\n\nfunction providerAccountConnectorUsesProviderApiKey(\n  connector: ProviderAccountStandardConnectorConfig | ProviderAccountHttpJsonConnectorConfig\n): boolean {\n  return (connector.auth ?? \"provider-api-key\") !== \"none\";\n}","sourceCodeStart":1432,"sourceCodeEnd":1468,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/providers/account-service.ts#L1432-L1468","documentation":"For local agent providers, the code loads the credential via localAgentProviderAccountCredential and requires a non-empty apiKey. If it is missing, the user must re-authenticate and re-import the local login provider.","triggerScenarios":"Provider API key matches localAgentProviderApiKey but no local agent credential (or empty apiKey) is found in config — typically after the local login session expired or was cleared.","commonSituations":"Local agent CLI session logged out or its token file removed; config directory reset; version change moved where local credentials are stored.","solutions":["Sign in again with the local agent CLI","Re-import the local login provider so the credential is captured","Retry the account operation"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const cred = await localAgentProviderAccountCredential(config, provider);\nif (!cred?.apiKey) { /* prompt re-login */ }","typeGuard":null,"tryCatchPattern":"catch (e) { if (e.message.includes('Sign in again')) { await promptLocalAgentLogin(); await reimportProvider(); } else throw e; }","preventionTips":["Surface re-login UX whenever local agent session ends","Check credential presence before account calls"],"tags":["local-agent","auth","credentials"],"backgroundTag":"session-expired","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}