{"record":{"id":"6cc1f35c43869005","repo":"remotion-dev/remotion","slug":"cannot-cancel-render-input-renderid-the-render","errorCode":null,"errorMessage":"Cannot cancel render ${input.renderId}: The render was not started with enableCancellation: true.","messagePattern":"Cannot cancel render (.+?): The render was not started with enableCancellation: true\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/cancel-render-on-lambda.ts","lineNumber":44,"sourceCode":"\nexport const internalCancelRenderOnLambda = async (\n\tinput: InternalCancelRenderOnLambdaInput,\n): Promise<void> => {\n\tconst expectedBucketOwner = await input.providerSpecifics.getAccountId({\n\t\tregion: input.region,\n\t});\n\tconst progress = await getOverallProgressFromStorage({\n\t\tbucketName: input.bucketName,\n\t\texpectedBucketOwner,\n\t\tregion: input.region,\n\t\trenderId: input.renderId,\n\t\tproviderSpecifics: input.providerSpecifics,\n\t\tforcePathStyle: input.forcePathStyle,\n\t\trequestHandler: input.requestHandler,\n\t});\n\n\tif (progress.cancellationEnabled !== true) {\n\t\tthrow new Error(\n\t\t\t`Cannot cancel render ${input.renderId}: The render was not started with enableCancellation: true.`,\n\t\t);\n\t}\n\n\tawait writeCancellationSignal({\n\t\tbucketName: input.bucketName,\n\t\trenderId: input.renderId,\n\t\tregion: input.region,\n\t\texpectedBucketOwner,\n\t\tproviderSpecifics: input.providerSpecifics,\n\t\tforcePathStyle: input.forcePathStyle,\n\t\trequestHandler: input.requestHandler,\n\t});\n};\n\n/*\n * @description Cancels an in-progress render that was started with enableCancellation: true.\n * @see [Documentation](https://remotion.dev/docs/lambda/cancelrenderonlambda)","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/lambda-client/src/cancel-render-on-lambda.ts#L26-L62","documentation":"internalCancelRenderOnLambda first fetches the render's progress.json from S3 and refuses to cancel when its cancellationEnabled flag is not exactly true. Cancellation is opt-in per render because it adds a progress-polling overhead; only renders started with `enableCancellation: true` (CLI `--enable-cancellation`) can later be cancelled via cancelRenderOnLambda.","triggerScenarios":"Calling `cancelRenderOnLambda({renderId, ...})` (or pressing Ctrl+C on a CLI render, which routes through the same code via unregisterCtrlCHandler) for a render that was started without `enableCancellation: true`.","commonSituations":"Adding a cancel button to an app for renders that were never started with cancellation enabled; upgrading a pipeline that predates the option and forgetting to set it at start time.","solutions":["Start renders you may need to cancel with `enableCancellation: true` (CLI: `--enable-cancellation`).","For an already-running non-cancellable render, wait for it to finish or delete its artifacts / let the retention period reap it; it cannot be cancelled retroactively.","Propagate the flag through your render API so client-initiated cancels are possible."],"exampleFix":"// before\nawait renderMediaOnLambda({composition: 'my-video', /* no enableCancellation */});\nawait cancelRenderOnLambda({renderId}); // throws\n\n// after\nawait renderMediaOnLambda({composition: 'my-video', enableCancellation: true});\nawait cancelRenderOnLambda({renderId});","handlingStrategy":"try-catch","validationCode":"// At render start, persist whether cancellation was enabled so the UI can disable the cancel button\nconst {renderId} = await renderMediaOnLambda({..., enableCancellation: true});\n// store renderId with cancellation: true; only offer cancel for those renders","typeGuard":null,"tryCatchPattern":"try {\n  await cancelRenderOnLambda({renderId, region, bucketName});\n} catch (e) {\n  if (e instanceof Error && e.message.includes('enableCancellation')) {\n    // render is not cancellable: mark as uncancellable in UI, do not retry\n  } else throw e;\n}","preventionTips":["Default enableCancellation: true for any render a user may want to abort.","Track the flag per render in your database and hide cancel actions for non-cancellable renders.","Note the flag adds overhead; enable it only where cancellation is a product requirement."],"tags":["lambda","render","cancellation"],"backgroundTag":"cancellation-not-enabled","analyzedSha":"10db9de07356446fb0edb3c3ae211369b693d18b","analyzedAt":"2026-08-22T21:45:17.748Z","contentChangedAt":"2026-08-22T21:45:17.748Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}