toeverything/AFFiNE · error

AUTH_SESSION_TEMPORARILY_UNAVAILABLE

AUTH_SESSION_TEMPORARILY_UNAVAILABLE

Error message

AUTH_SESSION_TEMPORARILY_UNAVAILABLE

What it means

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.

Source

Thrown at packages/frontend/apps/mobile-shared/src/auth/channel.ts:110

      this.pending.delete(id);
    });
    port.start();
  }

  async getValidAccessToken(endpoint: string) {
    try {
      return await this.request('get-valid', endpoint);
    } catch (error) {
      if (error instanceof Error && terminalAuthErrors.has(error.message)) {
        return null;
      }
      throw error;
    }
  }

  async refreshAccessToken(endpoint: string) {
    const token = await this.request('refresh', endpoint);
    if (!token) throw new Error(temporaryAuthError);
    return token;
  }

  private request(operation: AuthOperation, endpoint: string) {
    const port = this.port;
    if (!port) return Promise.reject(new Error(temporaryAuthError));

    const id = String(++this.nextRequestId);
    return new Promise<string | null>((resolve, reject) => {
      const timeout = setTimeout(() => {
        this.pending.delete(id);
        reject(new Error(temporaryAuthError));
      }, 5000);
      this.pending.set(id, {
        resolve: token => {
          clearTimeout(timeout);
          resolve(token);
        },

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Retry the operation; the auth session is temporarily unavailable.
  2. Check network connectivity and the auth server status.
  3. Sign in again if the session does not recover after retrying.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at packages/frontend/apps/mobile-shared/src/auth/channel.ts:110 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/9509b071a913050d. Report an issue: GitHub.