{"record":{"id":"d61f77702ff2b821","repo":"remotion-dev/remotion","slug":"job-is-not-running","errorCode":null,"errorMessage":"Job is not running","messagePattern":"Job is not running","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/render-queue/queue.ts","lineNumber":132,"sourceCode":"export const removeJob = (jobId: string) => {\n\tjobQueue = jobQueue.filter((job) => {\n\t\tif (job.id === jobId) {\n\t\t\tjob.cleanup.forEach((c) => {\n\t\t\t\tc();\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t});\n\tnotifyClientsOfJobUpdate();\n};\n\nexport const cancelJob = (jobId: string) => {\n\tfor (const job of jobQueue) {\n\t\tif (job.id === jobId) {\n\t\t\tif (job.status !== 'running') {\n\t\t\t\tthrow new Error('Job is not running');\n\t\t\t}\n\n\t\t\tjob.cancelToken.cancel();\n\t\t\tbreak;\n\t\t}\n\t}\n};\n\nconst processJobIfPossible = async ({\n\tremotionRoot,\n\tentryPoint,\n\tlogLevel,\n\tfixedConfig,\n}: {\n\tremotionRoot: string;\n\tentryPoint: string;\n\tlogLevel: LogLevel;\n\tfixedConfig: StudioRenderJobFixedConfig;","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/cli/src/render-queue/queue.ts#L114-L150","documentation":"Thrown by cancelJob in the Studio render queue when the located job's status is not 'running'. The queue only allows cancelling an actively executing job; queued, completed, failed, or cleaned-up jobs have no live cancelToken to invoke.","triggerScenarios":"The Studio UI (or a programmatic caller of cancelJob) sends a cancel request for a job that is still queued, already finished, already cancelled, or already removed. Also a race where the job transitions out of running between the UI render and the cancel click.","commonSituations":"Double-clicking Cancel; cancelling a job that just finished; UI state out of sync with the server-side queue; a job that errored before being marked running.","solutions":["Refresh the Studio render-queue UI and re-check the job's status before cancelling.","Only expose the Cancel action for jobs whose status === 'running'.","If using the API programmatically, guard the call with a status check (see defense).","For removing non-running jobs use removeJob instead of cancelJob."],"exampleFix":"// before - unconditional cancel\nimport {cancelJob} from '@remotion/cli/render-queue/queue';\ncancelJob(jobId);\n// after - guard on status\nimport {cancelJob, getJobs} from '@remotion/cli/render-queue/queue';\nconst job = getJobs().find(j => j.id === jobId);\nif (job && job.status === 'running') {\n  cancelJob(jobId);\n}","handlingStrategy":"type-guard","validationCode":"const safeCancel = (jobId: string) => {\n  const job = jobQueue.find((j) => j.id === jobId);\n  if (!job) return; // already removed\n  if (job.status !== 'running') return; // nothing to cancel\n  cancelJob(jobId);\n};\n\nsafeCancel(jobId);","typeGuard":"const isJobRunning = (job: {status: string} | undefined): job is {status: 'running'} =>\n  !!job && job.status === 'running';","tryCatchPattern":"try {\n  cancelJob(jobId);\n} catch (err) {\n  if (err instanceof Error && err.message === 'Job is not running') {\n    // benign - job already finished; refresh UI\n    return;\n  }\n  throw err;\n}","preventionTips":["Only show the Cancel control for jobs with status === 'running'.","Handle the 'Job is not running' message as benign in UI handlers.","Use removeJob to discard finished/queued jobs."],"tags":["studio","render-queue","state","api"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}