{"record":{"id":"e3325e4655ff6613","repo":"toeverything/AFFiNE","slug":"copilot-transcription-job-exists","errorCode":"copilot_transcription_job_exists","errorMessage":"Transcription job already exists","messagePattern":"Transcription job already exists","errorType":"exception","errorClass":"CopilotTranscriptionJobExists","httpStatus":400,"severity":"error","filePath":"packages/backend/server/src/plugins/copilot/transcript/service.ts","lineNumber":456,"sourceCode":"    userId: string,\n    workspaceId: string,\n    blobId: string,\n    blobs: FileUpload[],\n    input?: TranscriptionSubmitInput,\n    personal?: boolean\n  ): Promise<TranscriptionJob> {\n    const existingTask = await this.models.copilotTranscriptTask.getWithUser(\n      userId,\n      workspaceId,\n      undefined,\n      blobId,\n      personal\n    );\n    if (\n      existingTask &&\n      (existingTask.status === 'pending' || existingTask.status === 'running')\n    ) {\n      throw new CopilotTranscriptionJobExists();\n    }\n\n    await this.runtime.assertRoute(\n      'transcript.audio',\n      {},\n      {\n        user: userId,\n        workspace: workspaceId,\n        featureKind: 'transcript',\n        builtInRouteId: TRANSCRIPT_PROMPT_REF,\n      }\n    );\n    const infos = await this.persistUploads(userId, workspaceId, blobId, blobs);\n    const payload = this.createCanonicalPayload(blobId, infos, input);\n    const generation = randomUUID();\n    const task = await this.models.copilotTranscriptTask.create({\n      userId,\n      workspaceId,","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/2af30773aecd567f09b346e7b72fc69143144057/packages/backend/server/src/plugins/copilot/transcript/service.ts#L438-L474","documentation":"Raised in `submitTask` when an existing copilot transcription task for the same user/workspace/blob is still in 'pending' or 'running' status — the CopilotTranscriptionJobExists guard prevents duplicate concurrent transcription of the same audio blob. The input at fault is a repeated submission for a blob that already has an active job.","triggerScenarios":"Thrown at packages/backend/server/src/plugins/copilot/transcript/service.ts:432 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the existing transcription job instead of creating a duplicate for the same audio.","Wait for or poll the existing job to completion.","Delete or let the previous job settle before submitting the same audio again."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2af30773aecd567f09b346e7b72fc69143144057","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}