remotion-dev/remotion · error · RemotionException

Could not cancel render {render_id}: {error}

Error message

Could not cancel render {render_id}: {error}

What it means

After the opt-in check passes, cancel_render_on_lambda() writes renders/{render_id}/cancel.json via s3_client.put_object(...). A ClientError from that PUT is wrapped as RemotionException 'Could not cancel render ...' with the boto3 error chained as __cause__.

Source

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

            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
    ) -> Optional[RenderStillResponse]:
        """
        Render still using AWS Lambda.

        Args:
            render_params (RenderStillParams): Render parameters.

        Returns:
            Optional[RenderStillResponse]: Response from the render operation, or None if no body object.
        """
        params_json_str = self.construct_render_request(render_params, render_type='still') # Using Enum member

        body_object = self._invoke_lambda(

View on GitHub (pinned to 10db9de073)

Solutions

  1. Read the chained boto3 error (__cause__) - its code (AccessDenied, NoSuchBucket, SlowDown) identifies the cause.
  2. Grant s3:PutObject on arn:aws:s3:::<bucket>/renders/* to the credentials the Python client uses.
  3. Confirm bucket_name and region arguments match the ones the render used (take them from the render response).
  4. Retry on transient codes (5xx, SlowDown) - writing cancel.json again is harmless.
Defensive patterns

Strategy: try-catch

Validate before calling

import boto3
from botocore.exceptions import ClientError

s3 = boto3.client("s3", region_name=region)
try:
    s3.put_object(Bucket=bucket_name, Key="renders/_cancel-write-test", Body="{}")
    s3.delete_object(Bucket=bucket_name, Key="renders/_cancel-write-test")
except ClientError as e:
    raise RuntimeError(f"Cancel path cannot write to S3: {e}") from e

Try / catch

from remotion_lambda.errors import RemotionException

for attempt in range(2):
    try:
        client.cancel_render_on_lambda(render_id, bucket_name)
        break
    except RemotionException as e:
        cause = e.__cause__
        code = getattr(getattr(cause, "response", {}), "get", lambda *a: None)("Error", {}).get("Code")
        if attempt == 0 and code in ("SlowDown", "RequestTimeout", "InternalError"):
            continue  # transient - retry once
        if code == "AccessDenied":
            raise RuntimeError("Grant s3:PutObject on renders/* to the cancel credentials") from e
        raise

Prevention

When it happens

Trigger: Credentials without s3:PutObject on the bucket's renders/* prefix; wrong bucket_name or region argument; the bucket deleted; an endpoint or network failure during the PUT.

Common situations: Read-only AWS keys used by the script that cancels renders; bucket policies restricting writes to specific roles; VPC endpoint policies blocking S3 writes from the canceling workload.

Related errors


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