remotion-dev/remotion · error · RemotionInvalidArgumentException

Failed to serialize input properties for rendering: {e}

Error message

Failed to serialize input properties for rendering: {e}

What it means

Thrown by RemotionClient.construct_render_request when serializing the user-supplied input_props for a Lambda render fails. The inner _serialize_input_props call can fail for two reasons: the props contain values that cannot be JSON-serialized, or a boto3 ClientError occurs (large props are uploaded to S3 as an object rather than inlined). The catch wraps RemotionInvalidArgumentException and botocore ClientError, so the wrapped exception text identifies which path fired.

Source

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

        Construct a render request in JSON format.

        Args:
            render_params (Union[RenderMediaParams, RenderStillParams]): Render parameters.
            render_type (RenderType): The type of render (video-or-audio or still).

        Returns:
            str: JSON representation of the render request.
        """
        render_params.serve_url = self.serve_url

        try:
            # Assuming RenderMediaParams and RenderStillParams both have an input_props attribute
            # and a private_serialized_input_props attribute (even if Optional)
            render_params.private_serialized_input_props = self._serialize_input_props(
                input_props=render_params.input_props, render_type=render_type
            )
        except (RemotionInvalidArgumentException, ClientError) as e:
            raise RemotionInvalidArgumentException(
                f"Failed to serialize input properties for rendering: {e}"
            ) from e

        # Ensure serialize_params method in models.py is typed to return Dict[str, Any]
        payload: Dict[str, Any] = render_params.serialize_params()
        try:
            return json.dumps(payload, default=self._custom_serializer)
        except (TypeError, OverflowError) as e:
            raise RemotionInvalidArgumentException(
                f"Failed to serialize render parameters to JSON: {e}"
            ) from e

    def construct_render_progress_request(
        self,
        render_id: str,
        bucket_name: str,
        log_level: str = "info", # Added type hint
        s3_output_provider: Optional[CustomCredentials] = None,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Inspect the wrapped `from e` exception text to see whether it is a serialization error or a ClientError (S3).
  2. If it is a serialization error, reduce input_props to plain JSON types (str/int/float/bool/list/dict/None) and convert dates/Decimals/sets manually.
  3. If it is a ClientError, verify AWS credentials, region, and that the bucket configured for large-prop upload exists and is writable.
  4. Reproduce with a minimal input_props dict to isolate which field is non-serializable.

Example fix

// before
input_props={'created_at': datetime.now(), 'image': some_pil_image}
// after
from datetime import datetime
input_props={'created_at': datetime.now().isoformat(), 'image': None}
Defensive patterns

Strategy: try-catch

Validate before calling

import json
def input_props_are_serializable(props):
    try:
        json.dumps(props, default=str)
        return True
    except (TypeError, ValueError):
        return False

if not input_props_are_serializable(render_params.input_props or {}):
    raise ValueError('input_props contains non-JSON values')

Type guard

from typing import Any
def is_jsonable(v: Any) -> bool:
    return v is None or isinstance(v, (str, int, float, bool, list, dict))

Try / catch

from remotion_lambda.exceptions import RemotionInvalidArgumentException
try:
    client.render_media_on_lambda(render_params)
except RemotionInvalidArgumentException as e:
    if 'serialize input properties' in str(e):
        logger.error('Input props serialization failed: %s', e)
        # sanitize input_props and retry
    else:
        raise

Prevention

When it happens

Trigger: Passing RenderMediaParams/RenderStillParams with input_props containing non-JSON values (datetime, set, custom class, bytes), passing a props dict large enough to trigger the S3-upload path with misconfigured/missing S3 credentials, or a botocore ClientError raised mid-serialization (e.g. region mismatch, expired creds).

Common situations: Putting Python objects (e.g. PIL Image, Decimal, datetime) into input_props instead of primitives; running the client with the wrong AWS profile when props exceed the inline size limit; mixing enum values that the inner serializer does not handle.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/f3386fba7cad4018. Report an issue: GitHub.