{"record":{"id":"f3386fba7cad4018","repo":"remotion-dev/remotion","slug":"failed-to-serialize-input-properties-for-rendering","errorCode":null,"errorMessage":"Failed to serialize input properties for rendering: {e}","messagePattern":"Failed to serialize input properties for rendering: (.+?)","errorType":"exception","errorClass":"RemotionInvalidArgumentException","httpStatus":null,"severity":"error","filePath":"packages/lambda-python/remotion_lambda/remotionclient.py","lineNumber":556,"sourceCode":"        Construct a render request in JSON format.\n\n        Args:\n            render_params (Union[RenderMediaParams, RenderStillParams]): Render parameters.\n            render_type (RenderType): The type of render (video-or-audio or still).\n\n        Returns:\n            str: JSON representation of the render request.\n        \"\"\"\n        render_params.serve_url = self.serve_url\n\n        try:\n            # Assuming RenderMediaParams and RenderStillParams both have an input_props attribute\n            # and a private_serialized_input_props attribute (even if Optional)\n            render_params.private_serialized_input_props = self._serialize_input_props(\n                input_props=render_params.input_props, render_type=render_type\n            )\n        except (RemotionInvalidArgumentException, ClientError) as e:\n            raise RemotionInvalidArgumentException(\n                f\"Failed to serialize input properties for rendering: {e}\"\n            ) from e\n\n        # Ensure serialize_params method in models.py is typed to return Dict[str, Any]\n        payload: Dict[str, Any] = render_params.serialize_params()\n        try:\n            return json.dumps(payload, default=self._custom_serializer)\n        except (TypeError, OverflowError) as e:\n            raise RemotionInvalidArgumentException(\n                f\"Failed to serialize render parameters to JSON: {e}\"\n            ) from e\n\n    def construct_render_progress_request(\n        self,\n        render_id: str,\n        bucket_name: str,\n        log_level: str = \"info\", # Added type hint\n        s3_output_provider: Optional[CustomCredentials] = None,","sourceCodeStart":538,"sourceCodeEnd":574,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-python/remotion_lambda/remotionclient.py#L538-L574","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Inspect the wrapped `from e` exception text to see whether it is a serialization error or a ClientError (S3).","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.","If it is a ClientError, verify AWS credentials, region, and that the bucket configured for large-prop upload exists and is writable.","Reproduce with a minimal input_props dict to isolate which field is non-serializable."],"exampleFix":"// before\ninput_props={'created_at': datetime.now(), 'image': some_pil_image}\n// after\nfrom datetime import datetime\ninput_props={'created_at': datetime.now().isoformat(), 'image': None}","handlingStrategy":"try-catch","validationCode":"import json\ndef input_props_are_serializable(props):\n    try:\n        json.dumps(props, default=str)\n        return True\n    except (TypeError, ValueError):\n        return False\n\nif not input_props_are_serializable(render_params.input_props or {}):\n    raise ValueError('input_props contains non-JSON values')","typeGuard":"from typing import Any\ndef is_jsonable(v: Any) -> bool:\n    return v is None or isinstance(v, (str, int, float, bool, list, dict))","tryCatchPattern":"from remotion_lambda.exceptions import RemotionInvalidArgumentException\ntry:\n    client.render_media_on_lambda(render_params)\nexcept RemotionInvalidArgumentException as e:\n    if 'serialize input properties' in str(e):\n        logger.error('Input props serialization failed: %s', e)\n        # sanitize input_props and retry\n    else:\n        raise","preventionTips":["Build input_props only from JSON primitives; convert datetime/Decimal/set explicitly.","Run input_props through json.dumps in a pre-flight check before constructing render params.","Keep input_props under the inline size limit so the S3-upload path is not exercised unless needed.","Ensure the AWS profile used by the client has s3:PutObject on the configured bucket for large-prop uploads."],"tags":["python","lambda","serialization","input-props","aws"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}