toeverything/AFFiNE · error

Failed to fetch snapshot

Error message

Failed to fetch snapshot

What it means

snapshotFetcher throws when the history-snapshot API (/api/workspaces/:id/docs/:docId/histories/:ts) responds with a non-ok status, meaning the requested doc snapshot for that timestamp could not be retrieved from the server.

Source

Thrown at packages/frontend/core/src/components/affine/page-history-modal/data.ts:91

};

const snapshotFetcher = async (
  [fetchService, workspaceId, pageDocId, ts]: [
    FetchService,
    workspaceId: string,
    pageDocId: string,
    ts: string,
  ] // timestamp is the key to the history/snapshot
) => {
  if (!ts) {
    return null;
  }
  const res = await fetchService.fetch(
    `/api/workspaces/${workspaceId}/docs/${pageDocId}/histories/${ts}`
  );

  if (!res.ok) {
    throw new Error('Failed to fetch snapshot');
  }

  const snapshot = await res.arrayBuffer();
  if (!snapshot) {
    throw new Error('Invalid snapshot');
  }
  return snapshot;
};

// attach the Page shown in the modal to a temporary workspace
// so that we do not need to worry about providers etc
// TODO(@Peng): fix references to the page (the referenced page will shown as deleted)
// if we simply clone the current workspace, it maybe time consuming right?
const docCollectionMap = new Map<string, Workspace>();

// assume the workspace is a cloud workspace since the history feature is only enabled for cloud workspace
const getOrCreateShellWorkspace = (
  workspaceId: string,

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Retry fetching the page history snapshot; check network and server availability.
  2. Verify the workspace/doc ids used for the history request.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown in the page history snapshotFetcher when the GET request to /api/workspaces/:id/docs/:id/histories/:ts returns a non-OK response.

Common situations: Seen when opening page version history and the server rejects or cannot serve a snapshot. Check network/session and retry; the version may no longer exist.


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