remotion-dev/remotion · error · RemotionInvalidArgumentException
Invalid S3 client parameters for get_bucket_location: {e}
Error message
Invalid S3 client parameters for get_bucket_location: {e} What it means
Raised when boto3 rejects the parameters to get_bucket_location with a ParamValidationError (before any network call). The original ClientError is NOT caught here - it is re-raised; this wrapper only handles malformed parameter shapes passed to the S3 client.
Source
Thrown at packages/lambda-python/remotion_lambda/remotionclient.py:321
"""
try:
# Type hint for the response from get_bucket_location
bucket_region_response: Dict[str, Any] = s3_client.get_bucket_location(Bucket=bucket_name)
location: Optional[str] = bucket_region_response.get('LocationConstraint')
# us-east-1 returns None for LocationConstraint
return location == self.region or (
location is None and self.region == REGION_US_EAST
)
except ClientError as e:
logger.debug(
"Could not get bucket location for %s (possibly permission issue): %s",
bucket_name,
e,
)
raise e
except ParamValidationError as e:
raise RemotionInvalidArgumentException(
f"Invalid S3 client parameters for get_bucket_location: {e}"
) from e
def _get_or_create_bucket(self) -> str:
"""Get existing bucket or create a new one following JS SDK logic."""
buckets = self._get_remotion_buckets()
if len(buckets) > 1:
raise RemotionException(
f"You have multiple buckets ({', '.join(buckets)}) in your S3 region "
f"({self.region}) starting with \"remotionlambda-\". "
"Please see https://remotion.dev/docs/lambda/multiple-buckets."
)
if len(buckets) == 1:
return buckets[0]
bucket_name = self._make_bucket_name()View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Inspect the wrapped exception `e` (via __cause__) for the exact ParamValidationError field.
- Confirm the resolved bucket name is a non-empty string before calling render APIs.
- Validate that the configured region produces a valid S3 endpoint (e.g. 'us-east-1', not '').
- If you control the session, ensure the boto3 Session was created with a valid region_name.
Example fix
// before client = RemotionClient(region='', serve_url=..., function_name=...) client.renderMedia(...) # after client = RemotionClient(region='us-east-1', serve_url=..., function_name=...) client.renderMedia(...)
Defensive patterns
Strategy: try-catch
Validate before calling
def preflight_s3(session, bucket_name: str, region: str) -> None:
if not isinstance(bucket_name, str) or not bucket_name.strip():
raise ValueError(f'invalid bucket_name: {bucket_name!r}')
if not re.match(r'^[a-z0-9][a-z0-9.-]*[a-z0-9]$', bucket_name) or len(bucket_name) > 63:
raise ValueError(f'bucket_name not S3-compliant: {bucket_name!r}') Type guard
def is_valid_bucket_name(value) -> bool:\n return (isinstance(value, str)\n and 3 <= len(value) <= 63\n and bool(re.match(r'^[a-z0-9][a-z0-9.-]*[a-z0-9]$', value)))
Try / catch
try:\n client.render_media(...)\nexcept RemotionInvalidArgumentException as e:\n cause = e.__cause__\n log.error('S3 param validation failed: %s', cause)\n raise Prevention
- Validate bucket names match S3 naming rules before relying on them.
- Use a valid boto3 Session with a proper region_name.
- In tests, stub boto3 with the exact parameter shapes boto3 expects.
When it happens
Trigger: Calling _verify_bucket_region (used internally during _get_or_create_bucket) when bucket_name is None, empty, or not a string; when the S3 client itself was constructed with bad parameters; integration test stubs that feed non-string bucket names.
Common situations: Internal corruption of the bucket name (e.g. a bucket lookup returned an empty string); a malformed region propagating into the S3 client endpoint; mocking the S3 client incorrectly in tests; bucket name resolution returning a non-scalar value.
Related errors
- Invalid S3 client parameters for create_bucket: {e}
- Invalid S3 client parameters for put_object: {e}
- You have multiple buckets ({', '.join(buckets)}) in your S3
- Invalid Lambda invocation parameters: {e}
- 'bucketName' must be a string, but is ${JSON.stringify(bucke
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/2cebbeab1b47c863.
Report an issue: GitHub.