toeverything/AFFiNE · error · CalendarProviderRequestError

calendar_provider_request_error

calendar_provider_request_error

Error message

Calendar provider request error, status: ${status}, message: ${message}

What it means

fetchJson wraps every provider HTTP call and throws CalendarProviderRequestError with the upstream status/message when the response is not ok, normalizing remote calendar API failures (including timeouts via the timeout signal) into one error type.

Source

Thrown at packages/backend/server/src/plugins/calendar/providers/def.ts:179

  protected withTimeout(signal?: AbortSignal | null) {
    const timeoutMs = this.requestTimeoutMs;
    if (!timeoutMs) return signal;

    const timeoutSignal = AbortSignal.timeout(timeoutMs);
    if (!signal) return timeoutSignal;

    return AbortSignal.any([signal, timeoutSignal]);
  }

  protected async fetchJson<T>(url: string, init?: RequestInit) {
    const response = await fetch(url, {
      ...init,
      signal: this.withTimeout(init?.signal),
      headers: { ...init?.headers, Accept: 'application/json' },
    });
    const body = await response.text();
    if (!response.ok) {
      throw new CalendarProviderRequestError({
        status: response.status,
        message: body,
      });
    }
    if (!body) {
      return {} as T;
    }
    return JSON.parse(body) as T;
  }

  protected postFormJson<T>(
    url: string,
    body: string,
    options?: { headers?: Record<string, string> }
  ) {
    return this.fetchJson<T>(url, {
      method: 'POST',
      body,

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Inspect the status code and message returned by the calendar provider to find the root cause.
  2. Confirm the provider account is still connected and its credentials or tokens are valid.
  3. Retry after re-authenticating the calendar account; escalate to the provider if the error persists.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/backend/server/src/plugins/calendar/providers/def.ts:179 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/783745c8c99f0f60. Report an issue: GitHub.