toeverything/AFFiNE · error · Error

PDF not found

Error message

PDF not found

What it means

The PDF entity streams the blob from workspace blob storage; when get(id) resolves without a blob record (PDF deleted or never stored), the pipeline throws Error('PDF not found') in switchMap instead of emitting renderer output.

Source

Thrown at packages/frontend/core/src/modules/pdf/entities/pdf.ts:57

    from(
      this.workspaceService.workspace.engine.blob
        .get(this.id)
        .then(blobRecord => {
          if (blobRecord) {
            const { data, mime: type } = blobRecord;
            const blob = new Blob([toArrayBuffer(data)], { type });
            return blob.arrayBuffer();
          }

          return null;
        })
    ).pipe(
      switchMap(data => {
        if (data) {
          return this.renderer.ob$('open', { data });
        }

        throw new Error('PDF not found');
      }),
      map(meta => ({ status: PDFStatus.Opened, meta })),
      // @ts-expect-error type alias
      startWith({ status: PDFStatus.Opening }),
      catchError((error: Error) => of({ status: PDFStatus.Error, error }))
    ),
    { status: PDFStatus.IDLE }
  );

  constructor(private readonly workspaceService: WorkspaceService) {
    super();
    this.disposables.push(() => this.pages.clear());
  }

  page(pageNum: number, size: string) {
    const key = `${pageNum}:${size}`;
    let rc = this.pages.get(key);

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Ensure the PDF blob is uploaded before opening the viewer.
  2. Verify the PDF id and storage availability.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown in the PDF entity state stream when the workspace blob engine returns no blob record for the PDF's blobId, so no data can be fed to the renderer.

Common situations: A user opens a PDF attachment whose blob is missing or not yet synced to the workspace storage. Wait for sync to finish or re-upload the PDF.


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