remotion-dev/remotion · error · RemotionInvalidArgumentException
Invalid Lambda invocation parameters: {e}
Error message
Invalid Lambda invocation parameters: {e} What it means
Raised when boto3 rejects the parameters to client.invoke() with a ParamValidationError (before the call). This means FunctionName or Payload has an invalid type/shape - not an AWS service error. ClientError (network/auth/service) is re-raised separately.
Source
Thrown at packages/lambda-python/remotion_lambda/remotionclient.py:487
def _invoke_lambda(self, function_name: str, payload: str) -> Dict[str, Any]: # Added type hints
"""Invokes the Remotion Lambda function and parses its response."""
client = self._create_lambda_client()
result_raw: Optional[str] = None # Renamed to avoid confusion with `decoded_result`
decoded_result: Dict[str, Any] = {}
try:
# boto3.client('lambda').invoke returns a dictionary.
# 'Payload' is a StreamingBody object.
response: Dict[str, Any] = client.invoke(FunctionName=function_name, Payload=payload)
streaming_body: StreamingBody = response['Payload']
result_raw = streaming_body.read().decode('utf-8')
parsed_results = self._parse_stream(result_raw)
decoded_result = parsed_results[-1] if parsed_results else {}
except ClientError as e:
raise e
except ParamValidationError as e:
raise RemotionInvalidArgumentException(
f"Invalid Lambda invocation parameters: {e}"
) from e
except json.JSONDecodeError as e:
raise RemotionException(
f"Failed to decode final Lambda response: {e}. Raw response: {result_raw}"
) from e
except UnicodeDecodeError as e:
raise RemotionException(
f"Failed to decode Lambda response payload: {e}"
) from e
if 'errorMessage' in decoded_result:
raise RemotionRenderingOutputError(
f"Lambda function returned an error: {decoded_result['errorMessage']}"
)
if 'type' in decoded_result and decoded_result['type'] == 'error':
raise RemotionRenderingOutputError(View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Inspect __cause__ for the exact ParamValidationError report.
- Confirm function_name is a non-empty string matching a deployed Lambda.
- Ensure the payload passed to render APIs serializes to a non-empty JSON string.
- Recreate the client with valid region/Session so the internal Lambda client is correctly configured.
Example fix
// before
client = RemotionClient(region='us-east-1', serve_url=..., function_name='')
client.render_media(...)
# after
client = RemotionClient(
region='us-east-1',
serve_url=serve_url,
function_name='remotion-render-remotionlambda-...-us-east-1',
)
client.render_media(...) Defensive patterns
Strategy: validation
Validate before calling
def preflight_invoke(function_name: str, payload: str) -> None:
if not (isinstance(function_name, str) and function_name.strip()):
raise ValueError(f'invalid function_name: {function_name!r}')
if not isinstance(payload, (str, bytes)):
raise ValueError(f'invalid payload type: {type(payload).__name__}') Type guard
def is_invokable(function_name, payload) -> bool:\n return (isinstance(function_name, str) and bool(function_name.strip())\n and isinstance(payload, (str, bytes)))
Try / catch
try:\n client.render_media(...)\nexcept RemotionInvalidArgumentException as e:\n log.error('invoke param error: %s', e.__cause__)\n raise Prevention
- Always pass a non-empty function_name from a known deployment.
- Use a valid boto3 Session so the internal Lambda client is correctly configured.
- Do not bypass constructor validation that guards function_name.
When it happens
Trigger: Calling _invoke_lambda with a non-string function_name, an empty function name, a Payload that is not bytes/str/file-like, or an internal Lambda client that was constructed with bad parameters.
Common situations: function_name resolved to None because the constructor validation was bypassed; payload pre-serialization bug producing None; mocking the Lambda client with broken stubs; integration tests passing wrong types.
Related errors
- 'serve_url' parameter is required and cannot be empty or whi
- 'function_name' parameter is required and cannot be empty or
- Invalid S3 client parameters for get_bucket_location: {e}
- Invalid S3 client parameters for create_bucket: {e}
- Invalid S3 client parameters for put_object: {e}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/87de0c56ecb81ec5.
Report an issue: GitHub.