toeverything/AFFiNE · error · BadRequestException

Ready or settled transcript tasks cannot be retried

Error message

Ready or settled transcript tasks cannot be retried

What it means

A BadRequestException guard in the transcript retry flow: it fires when retryTask is invoked on a task whose status is 'ready' or 'settled', i.e. transcription already completed and produced a final result. Retrying such tasks is meaningless, so the request is rejected before any job is re-enqueued; the input at fault is taskId pointing at an already-finished task.

Source

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

  constructor(
    private readonly models: Models,
    private readonly job: JobQueue,
    private readonly runtime: CapabilityRuntime,
    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,

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Only retry jobs that are in a failed state; ready or settled jobs are final.
  2. Check the job status first and skip the retry when it already succeeded.
  3. If the result is wrong, create a new transcription job instead of retrying a settled one.
Defensive patterns

Strategy: validation

When it happens

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