toeverything/AFFiNE · error · Error

Failed to create recording attachment

Error message

Failed to create recording attachment

What it means

A post-write verification in createRecordingDoc: after calling doc.blockSuiteDoc.addBlock('affine:attachment', ...) the code immediately looks the new block up by the returned id. It fires when that lookup returns no model, meaning BlockSuite accepted the addBlock call but the block is not retrievable — a store/sync inconsistency or rejected block prop, not bad user input.

Source

Thrown at packages/frontend/apps/electron-renderer/src/app/effects/recording.ts:223

      );

      const attachmentId = doc.blockSuiteDoc.addBlock(
        'affine:attachment',
        {
          name: attachmentName,
          type: NATIVE_RECORDING_MIME_TYPE,
          size: blob.size,
          sourceId: blobId,
          embed: true,
        },
        noteId
      );

      model = doc.blockSuiteDoc.getBlock(attachmentId)?.model as
        | AttachmentBlockModel
        | undefined;
      if (!model) {
        throw new Error('Failed to create recording attachment');
      }
      attachmentCreated = true;
    }

    const transcriptionBlock = ensureTranscriptionBlock(model);
    transcriptionBlock.props.transcription = {
      sourceAudio: {
        mimeType: model.props.type,
        durationMs: status.durationMs,
        sampleRate: status.sampleRate,
        channels: status.numberOfChannels,
      },
      quality: {
        degraded: status.degraded,
        overflowCount: status.overflowCount,
      },
    };

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Verify the recording blob uploaded successfully before creating the attachment.
  2. Retry the import; attachment creation can fail on transient storage errors.
  3. Check storage quota and permissions for the workspace.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/frontend/apps/electron-renderer/src/app/effects/recording.ts:223 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/8946b69c92fa32be. Report an issue: GitHub.