toeverything/AFFiNE · error · BadRequestException

Only failed transcript tasks can be retried

Error message

Only failed transcript tasks can be retried

What it means

A status-machine guard in transcript retry: after ruling out 'ready'/'settled' tasks, this fires when the task status is anything other than 'failed' (e.g. 'pending' or 'running'). Only failed transcription tasks may be re-enqueued, so the retry request for taskId is rejected as a bad request rather than corrupting an in-flight task.

Source

Thrown at packages/backend/server/src/plugins/copilot/transcript/retry.ts:47

    private readonly realtime: RealtimePublisher
  ) {}

  async retryTask(userId: string, workspaceId: string, taskId: string) {
    const task = await this.models.copilotTranscriptTask.getWithUser(
      userId,
      workspaceId,
      taskId
    );
    if (!task) {
      throw new CopilotTranscriptionJobNotFound();
    }
    if (task.status === 'ready' || task.status === 'settled') {
      throw new BadRequestException(
        'Ready or settled transcript tasks cannot be retried'
      );
    }
    if (task.status !== 'failed') {
      throw new BadRequestException(
        'Only failed transcript tasks can be retried'
      );
    }

    const payload = TranscriptPayloadSchema.parse(task.protectedResult);
    await this.runtime.assertRoute(
      'transcript.audio',
      {},
      {
        user: userId,
        workspace: workspaceId,
        featureKind: 'transcript',
        builtInRouteId: TRANSCRIPT_PROMPT_REF,
      }
    );
    const generation = randomUUID();
    const retryOf = task.actionRunId ?? null;
    const claimed = await this.models.copilotTranscriptTask.claimRetry(

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Check the job status and only call retry on jobs whose status is failed.
  2. Wait for the job to finish; a running or completed job cannot be retried.
  3. Create a new transcription job if the current one is not retryable.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/backend/server/src/plugins/copilot/transcript/retry.ts:47 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/61d06591fc453828. Report an issue: GitHub.