remotion-dev/remotion · error · RemotionInvalidArgumentException

Cannot cancel render {render_id}: The render was not started

Error message

Cannot cancel render {render_id}: The render was not started with enableCancellation: true.

What it means

cancel_render_on_lambda() in the Python client requires the render to have been started with enable_cancellation=True. After reading renders/{render_id}/progress.json, it checks progress.get('cancellationEnabled') and raises RemotionInvalidArgumentException when it is not True. Cancellation is opt-in in Remotion Lambda because enabling it adds overhead during rendering.

Source

Thrown at packages/lambda-python/remotion_lambda/remotionclient.py:645

        return None

    def cancel_render_on_lambda(self, render_id: str, bucket_name: str) -> None:
        """Cancel a render started with ``enable_cancellation=True``."""
        s3_client = self._create_s3_client()
        try:
            progress_object = s3_client.get_object(
                Bucket=bucket_name,
                Key=f"renders/{render_id}/progress.json",
            )
            progress = json.loads(progress_object['Body'].read())
        except (ClientError, KeyError, TypeError, json.JSONDecodeError) as error:
            raise RemotionException(
                f"Could not read progress for render {render_id}: {error}"
            ) from error

        if progress.get('cancellationEnabled') is not True:
            raise RemotionInvalidArgumentException(
                f"Cannot cancel render {render_id}: The render was not started "
                "with enableCancellation: true."
            )

        try:
            s3_client.put_object(
                Bucket=bucket_name,
                Key=f"renders/{render_id}/cancel.json",
                Body=json.dumps({'cancelledAt': int(time.time() * 1000)}),
                ContentType='application/json',
            )
        except ClientError as error:
            raise RemotionException(
                f"Could not cancel render {render_id}: {error}"
            ) from error

    def render_still_on_lambda(
        self, render_params: RenderStillParams

View on GitHub (pinned to 10db9de073)

Solutions

  1. Start cancellable renders: pass RenderMediaParams(..., enable_cancellation=True) to render_media_on_lambda().
  2. The current non-cancellable render cannot be converted mid-flight - wait for it to finish or start a new render with the flag enabled.
  3. Verify renders/{render_id}/progress.json contains cancellationEnabled: true shortly after the render starts.
  4. If the field is absent from progress.json, update the deployed Remotion functions (npx remotion lambda update) to match your client version.

Example fix

# before
params = RenderMediaParams(
    composition="my-video",
    # enable_cancellation defaults to False
)
response = client.render_media_on_lambda(params)
client.cancel_render_on_lambda(response.render_id, bucket_name)  # raises

# after
params = RenderMediaParams(
    composition="my-video",
    enable_cancellation=True,
)
response = client.render_media_on_lambda(params)
client.cancel_render_on_lambda(response.render_id, bucket_name)  # works
Defensive patterns

Strategy: validation

Validate before calling

# Render time - opt in once, in one place
from remotion_lambda.models import RenderMediaParams

params = RenderMediaParams(
    composition="my-video",
    enable_cancellation=True,  # required for cancel_render_on_lambda()
)
response = client.render_media_on_lambda(params)

Try / catch

from remotion_lambda.errors import RemotionInvalidArgumentException

try:
    client.cancel_render_on_lambda(render_id, bucket_name)
except RemotionInvalidArgumentException as e:
    if "enableCancellation" in str(e):
        # render is not cancellable - report clearly, do not retry with the same params
        pass
    else:
        raise

Prevention

When it happens

Trigger: Calling cancel_render_on_lambda() on a render whose RenderMediaParams left enable_cancellation at its default of False (packages/lambda-python/remotion_lambda/models.py: enable_cancellation: bool = False), i.e. the params object was constructed without enable_cancellation=True.

Common situations: Deciding to cancel only after the render started; putting enable_cancellation into input_props or a nested dict instead of the top-level RenderMediaParams field; deployed Remotion Lambda functions older than the Python client so progress.json lacks the field.

Related errors


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