{"record":{"id":"a61fa86cb2a4e408","repo":"remotion-dev/remotion","slug":"cannot-cancel-render-s-the-render-was-not-starte","errorCode":null,"errorMessage":"cannot cancel render %s: the render was not started with enableCancellation: true","messagePattern":"cannot cancel render (.+?): the render was not started with enableCancellation: true","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/lambda-go/s3.go","lineNumber":102,"sourceCode":"\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not read progress for render %q: %w\", input.RenderId, err)\n\t}\n\tdefer progressObject.Body.Close()\n\n\tprogressBody, err := io.ReadAll(progressObject.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not read progress for render %q: %w\", input.RenderId, err)\n\t}\n\n\tvar progress struct {\n\t\tCancellationEnabled bool `json:\"cancellationEnabled\"`\n\t}\n\tif err := json.Unmarshal(progressBody, &progress); err != nil {\n\t\treturn fmt.Errorf(\"could not parse progress for render %q: %w\", input.RenderId, err)\n\t}\n\tif !progress.CancellationEnabled {\n\t\treturn fmt.Errorf(\"cannot cancel render %s: the render was not started with enableCancellation: true\", input.RenderId)\n\t}\n\n\tcancellationBody, err := json.Marshal(map[string]int64{\"cancelledAt\": time.Now().UnixMilli()})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not serialize cancellation signal: %w\", err)\n\t}\n\t_, err = client.PutObject(context.TODO(), &s3.PutObjectInput{\n\t\tBucket:      new(input.BucketName),\n\t\tKey:         new(cancellationKey(input.RenderId)),\n\t\tBody:        strings.NewReader(string(cancellationBody)),\n\t\tContentType: new(\"application/json\"),\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not cancel render %q: %w\", input.RenderId, err)\n\t}\n\n\treturn nil\n}","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/lambda-go/s3.go#L84-L120","documentation":"Go counterpart of the TypeScript check: after parsing progress.json, cancellationEnabled is false, so the render was started without opt-in cancellation and the client refuses to write the cancellation signal. Mirrors `Cannot cancel render ...: enableCancellation: true` from @remotion/lambda-client.","triggerScenarios":"CancelRenderOnLambda for a render started by StartRenderOnLambda (or another client) without `EnableCancellation: true` / CLI `--enable-cancellation`.","commonSituations":"Adding cancellation to an existing Go integration whose renders never set the flag; mixed clients (TS starts, Go cancels) where the starter forgot the flag.","solutions":["Start the render with EnableCancellation: true in StartRenderOnLambdaInput.","For a running non-cancellable render, wait it out or clean up artifacts; cancellation cannot be applied retroactively."],"exampleFix":"// before\n_, err := client.StartRenderOnLambda(ctx, &StartRenderOnLambdaInput{/* no EnableCancellation */})\nerr = client.CancelRenderOnLambda(ctx, input) // -> cannot cancel\n\n// after\ninput.EnableCancellation = true\n_, err := client.StartRenderOnLambda(ctx, input)\nerr = client.CancelRenderOnLambda(ctx, input)","handlingStrategy":"try-catch","validationCode":"// Start renders you will cancel with the opt-in flag\nin := &StartRenderOnLambdaInput{...}\nin.EnableCancellation = true\n_, err := client.StartRenderOnLambda(ctx, in)","typeGuard":null,"tryCatchPattern":"if err := client.CancelRenderOnLambda(ctx, input); err != nil {\n  if strings.Contains(err.Error(), \"enableCancellation\") {\n    // not cancellable: wait for completion instead\n    return nil\n  }\n  return err\n}","preventionTips":["Set EnableCancellation: true on every start call that feeds a cancellable workflow.","Record the flag alongside the renderId so workers know whether cancel is legal."],"tags":["go","cancellation","lambda","render"],"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"}