{"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":432,"sourceCode":"\n  async submitTask(\n    userId: string,\n    workspaceId: string,\n    blobId: string,\n    blobs: FileUpload[],\n    input?: TranscriptionSubmitInput\n  ): Promise<TranscriptionJob> {\n    const existingTask = await this.models.copilotTranscriptTask.getWithUser(\n      userId,\n      workspaceId,\n      undefined,\n      blobId\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":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/591f874dad30887a80143a061a44bd3ca7ee3299/packages/backend/server/src/plugins/copilot/transcript/service.ts#L414-L450","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":"591f874dad30887a80143a061a44bd3ca7ee3299","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}