remotion-dev/remotion · error · RemotionRenderingOutputError
Unexpected Lambda response format: {result_raw}
Error message
Unexpected Lambda response format: {result_raw} What it means
Raised when the parsed Lambda response dict does NOT contain type === 'success' (and is not an errorMessage or type='error'). This is the catch-all for an unexpected response shape - the function returned something the client cannot interpret as success, controlled error, or runtime crash.
Source
Thrown at packages/lambda-python/remotion_lambda/remotionclient.py:509
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(
f"Remotion rendering error: {decoded_result['message']}"
)
if 'type' not in decoded_result or decoded_result['type'] != 'success':
raise RemotionRenderingOutputError(
f"Unexpected Lambda response format: {result_raw}"
)
return decoded_result
def _custom_serializer(self, obj: Any) -> Any: # Added type hints
"""A custom JSON serializer that handles enums and objects."""
if isinstance(obj, Enum):
return obj.value if hasattr(obj, 'value') else obj.name
# Check if it's a dataclass instance before calling asdict
# This often works better with mypy than just a try-except.
if hasattr(obj, '__dataclass_fields__'):
return asdict(obj)
if hasattr(obj, '__dict__'):
return obj.__dict__
if hasattr(obj, '__iter__') and not isinstance(obj, (str, bytes, bytearray)):
return list(obj)
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Inspect the raw response text in the error message to understand what the function actually returned.
- Verify the deployed Lambda function IS a Remotion render function and its version matches the Python client.
- Confirm the function name in the client points to the right deployed function.
- Re-deploy the function with `remotion lambda functions deploy` and update the client version to match.
Example fix
// before - calling a non-Remotion Lambda
client = RemotionClient(region=..., serve_url=..., function_name='my-other-function')
client.render_media(...)
# after
client = RemotionClient(
region=...,
serve_url=serve_url,
function_name='remotion-render-remotionlambda-...-us-east-1',
)
client.render_media(...) Defensive patterns
Strategy: try-catch
Validate before calling
def assert_remotion_function(session, function_name: str) -> None:
lam = session.client('lambda')
tags = lam.list_tags(Resource=function_name).get('Tags', {})
if tags.get('remotion:version') is None:
raise ValueError(f'{function_name} does not look like a Remotion Lambda') Try / catch
try:\n result = client.render_media(...)\nexcept RemotionRenderingOutputError as e:\n raw = str(e) # contains raw response text\n log.error('Unexpected Lambda response format. raw=%s', raw)\n raise Prevention
- Use a Remotion-deployed Lambda function (look for the remotion:version tag).
- Keep the Python client and Lambda function on matching Remotion versions.
- Verify the function name in the client matches a deployed Remotion function.
When it happens
Trigger: Lambda returns a partial/empty dict, a chunk from a streaming progress event that was selected as the terminal result, or a response from an unrelated Lambda deployed to the same name. The raw response text is included for diagnosis.
Common situations: Version mismatch between the Python client and the deployed Remotion Lambda function; calling a non-Remotion Lambda by accident; selecting a progress chunk instead of the final chunk; truncated response leaving an empty dict.
Related errors
- Invalid JSON: ${JSON.stringify(decoded)}
- You have multiple buckets ({', '.join(buckets)}) in your S3
- Failed to parse Lambda response stream: {e}
- Failed to decode final Lambda response: {e}. Raw response: {
- Failed to decode Lambda response payload: {e}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/2f9cfcdafd4da1fe.
Report an issue: GitHub.