{"record":{"id":"5ef8bc561c83cf9f","repo":"earendil-works/pi","slug":"authentication-failed-for-model-provider-cre","errorCode":null,"errorMessage":"Authentication failed for \"${model.provider}\". Credentials may have expired or network is unavailable. Run '/login ${model.provider}' to re-authenticate.","messagePattern":"Authentication failed for \"(.+?)\"\\. Credentials may have expired or network is unavailable\\. Run '/login (.+?)' to re-authenticate\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/core/agent-session.ts","lineNumber":442,"sourceCode":"\t\t\tconst cause = error instanceof Error ? error.cause : undefined;\n\t\t\tif (cause instanceof Error && cause.message === \"authHeader requires a resolved API key\") {\n\t\t\t\tthrow new Error(formatNoApiKeyFoundMessage(model.provider));\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tif (result && (result.auth.apiKey || result.auth.headers)) {\n\t\t\tconst requestModel = result.auth.baseUrl ? { ...model, baseUrl: result.auth.baseUrl } : model;\n\t\t\treturn {\n\t\t\t\tmodel: requestModel,\n\t\t\t\tapiKey: result.auth.apiKey,\n\t\t\t\theaders: withoutDeletedHeaders(result.auth.headers),\n\t\t\t\tenv: result.env,\n\t\t\t};\n\t\t}\n\n\t\tconst isOAuth = this._modelRuntime.isUsingOAuth(model.provider);\n\t\tif (isOAuth) {\n\t\t\tthrow new Error(\n\t\t\t\t`Authentication failed for \"${model.provider}\". ` +\n\t\t\t\t\t`Credentials may have expired or network is unavailable. ` +\n\t\t\t\t\t`Run '/login ${model.provider}' to re-authenticate.`,\n\t\t\t);\n\t\t}\n\t\tthrow new Error(formatNoApiKeyFoundMessage(model.provider));\n\t}\n\n\tprivate async _getSummarizationRequestAuth(model: Model<any>): Promise<{\n\t\tmodel: Model<any>;\n\t\tapiKey?: string;\n\t\theaders?: Record<string, string>;\n\t\tenv?: Record<string, string>;\n\t}> {\n\t\tif (this.agent.streamFunction === streamSimple) {\n\t\t\treturn this._getRequiredRequestAuth(model);\n\t\t}\n","sourceCodeStart":424,"sourceCodeEnd":460,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/coding-agent/src/core/agent-session.ts#L424-L460","documentation":"Error \"Authentication failed for \"${model.provider}\". Credentials may have expired or network is unavailable. Run '/login ${model.provider}' to re-authenticate.\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/coding-agent/src/core/agent-session.ts:442 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}