{"record":{"id":"9509b071a913050d","repo":"toeverything/AFFiNE","slug":"auth-session-temporarily-unavailable-9509b0","errorCode":"AUTH_SESSION_TEMPORARILY_UNAVAILABLE","errorMessage":"AUTH_SESSION_TEMPORARILY_UNAVAILABLE","messagePattern":"AUTH_SESSION_TEMPORARILY_UNAVAILABLE","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/frontend/apps/mobile-shared/src/auth/channel.ts","lineNumber":110,"sourceCode":"      this.pending.delete(id);\n    });\n    port.start();\n  }\n\n  async getValidAccessToken(endpoint: string) {\n    try {\n      return await this.request('get-valid', endpoint);\n    } catch (error) {\n      if (error instanceof Error && terminalAuthErrors.has(error.message)) {\n        return null;\n      }\n      throw error;\n    }\n  }\n\n  async refreshAccessToken(endpoint: string) {\n    const token = await this.request('refresh', endpoint);\n    if (!token) throw new Error(temporaryAuthError);\n    return token;\n  }\n\n  private request(operation: AuthOperation, endpoint: string) {\n    const port = this.port;\n    if (!port) return Promise.reject(new Error(temporaryAuthError));\n\n    const id = String(++this.nextRequestId);\n    return new Promise<string | null>((resolve, reject) => {\n      const timeout = setTimeout(() => {\n        this.pending.delete(id);\n        reject(new Error(temporaryAuthError));\n      }, 5000);\n      this.pending.set(id, {\n        resolve: token => {\n          clearTimeout(timeout);\n          resolve(token);\n        },","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/apps/mobile-shared/src/auth/channel.ts#L92-L128","documentation":"The mobile auth channel's refreshAccessToken throws an Error with the temporaryAuthError code when the main-process bridge returns no token, mapping a failed background refresh to AUTH_SESSION_TEMPORARILY_UNAVAILABLE for callers to retry or degrade to offline.","triggerScenarios":"Thrown at packages/frontend/apps/mobile-shared/src/auth/channel.ts:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the operation; the auth session is temporarily unavailable.","Check network connectivity and the auth server status.","Sign in again if the session does not recover after retrying."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}