remotion-dev/remotion · error

cannot cancel render %s: the render was not started with ena

Error message

cannot cancel render %s: the render was not started with enableCancellation: true

What it means

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.

Source

Thrown at packages/lambda-go/s3.go:102

	})
	if err != nil {
		return fmt.Errorf("could not read progress for render %q: %w", input.RenderId, err)
	}
	defer progressObject.Body.Close()

	progressBody, err := io.ReadAll(progressObject.Body)
	if err != nil {
		return fmt.Errorf("could not read progress for render %q: %w", input.RenderId, err)
	}

	var progress struct {
		CancellationEnabled bool `json:"cancellationEnabled"`
	}
	if err := json.Unmarshal(progressBody, &progress); err != nil {
		return fmt.Errorf("could not parse progress for render %q: %w", input.RenderId, err)
	}
	if !progress.CancellationEnabled {
		return fmt.Errorf("cannot cancel render %s: the render was not started with enableCancellation: true", input.RenderId)
	}

	cancellationBody, err := json.Marshal(map[string]int64{"cancelledAt": time.Now().UnixMilli()})
	if err != nil {
		return fmt.Errorf("could not serialize cancellation signal: %w", err)
	}
	_, err = client.PutObject(context.TODO(), &s3.PutObjectInput{
		Bucket:      new(input.BucketName),
		Key:         new(cancellationKey(input.RenderId)),
		Body:        strings.NewReader(string(cancellationBody)),
		ContentType: new("application/json"),
	})
	if err != nil {
		return fmt.Errorf("could not cancel render %q: %w", input.RenderId, err)
	}

	return nil
}

View on GitHub (pinned to 10db9de073)

Solutions

  1. Start the render with EnableCancellation: true in StartRenderOnLambdaInput.
  2. For a running non-cancellable render, wait it out or clean up artifacts; cancellation cannot be applied retroactively.

Example fix

// before
_, err := client.StartRenderOnLambda(ctx, &StartRenderOnLambdaInput{/* no EnableCancellation */})
err = client.CancelRenderOnLambda(ctx, input) // -> cannot cancel

// after
input.EnableCancellation = true
_, err := client.StartRenderOnLambda(ctx, input)
err = client.CancelRenderOnLambda(ctx, input)
Defensive patterns

Strategy: try-catch

Validate before calling

// Start renders you will cancel with the opt-in flag
in := &StartRenderOnLambdaInput{...}
in.EnableCancellation = true
_, err := client.StartRenderOnLambda(ctx, in)

Try / catch

if err := client.CancelRenderOnLambda(ctx, input); err != nil {
  if strings.Contains(err.Error(), "enableCancellation") {
    // not cancellable: wait for completion instead
    return nil
  }
  return err
}

Prevention

When it happens

Trigger: CancelRenderOnLambda for a render started by StartRenderOnLambda (or another client) without `EnableCancellation: true` / CLI `--enable-cancellation`.

Common situations: 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.

Related errors


AI-assisted analysis of remotion-dev/remotion@10db9de073 (2026-08-22). Data as JSON: /api/errors/a61fa86cb2a4e408. Report an issue: GitHub.