remotion-dev/remotion · error · Exception
Error serializing inputProps. Check it has no circular refer
Error message
Error serializing inputProps. Check it has no circular references or reduce the size if the object is big.
What it means
Thrown by the PHP Lambda client's input-props upload flow when ANY exception occurs inside the try block that hashes the payload, resolves an S3 bucket, computes the storage key, and uploads the props to S3. The message points at serialization but the catch is generic (catches Exception), so it also surfaces for S3/bucket/hash failures. Treat it as 'input-props staging failed' rather than strictly a JSON circular-reference problem.
Source
Thrown at packages/lambda-php/src/PHPClient.php:389
return [
'type' => 'payload',
'payload' => $this->ensureValidPayload($payload),
];
}
$hash = $this->generateHash($payload);
$bucketName = $this->getOrCreateBucket();
$key = $this->inputPropsKey($hash);
$this->uploadToS3($bucketName, $key, $payload);
return [
'hash' => $hash,
'type' => 'bucket-url',
'bucketName' => $bucketName,
];
} catch (Exception $e) {
throw new Exception(
'Error serializing inputProps. Check it has no circular references or reduce the size if the object is big.'
);
}
}
public function getRegion(): string
{
return $this->region;
}
public function setRegion(string $region): void
{
$this->region = $region;
}
public function getServeUrl(): string
{
return $this->serveUrl;View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Inspect the swallowed $e->getMessage() by temporarily rethrowing it (throw $e) to identify the real root cause before the generic message replaces it.
- Ensure inputProps contain only scalar/array data; json_encode the payload yourself first and check json_last_error_msg() before calling render.
- If props are large, confirm the bucket exists and the configured region/credentials are correct, since uploadToS3 failures are masked by this same message.
- Remove circular references or non-JSON values (objects without JsonSerializable, resources, Closures) from inputProps.
Example fix
// before
$inputProps = ['component' => $someClosure, 'data' => $objWithRef];
$client->renderMedia($compId, $inputProps);
// after - debug real cause
try {
json_encode($inputProps);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new RuntimeException('inputProps JSON error: ' . json_last_error_msg());
}
$client->renderMedia($compId, $inputProps);
} catch (Exception $e) {
error_log('Real cause: ' . $e->getMessage());
throw $e;
} Defensive patterns
Strategy: try-catch
Validate before calling
$json = json_encode($inputProps);
if ($json === false) {
throw new InvalidArgumentException('inputProps not serializable: ' . json_last_error_msg());
}
if (strlen($json) > 5000000) {
throw new InvalidArgumentException('inputProps too large for inline upload: ' . strlen($json) . ' bytes');
} Type guard
function isJsonSerializableProps($props): bool {\n json_encode($props);\n return json_last_error() === JSON_ERROR_NONE;\n} Try / catch
try {\n $client->renderMedia($compId, $inputProps);\n} catch (Exception $e) {\n // The library message is generic; re-run with throw $e in dev to see real cause\n error_log('inputProps staging failed: ' . $e->getMessage());\n throw $e;\n} Prevention
- Pre-validate inputProps with json_encode and check json_last_error before calling render.
- Strip Closures, resources, and objects without JsonSerializable from inputProps.
- Keep inputProps payloads under 5MB to stay within inline-upload limits.
- In dev, temporarily replace the generic catch with throw $e to surface the real exception.
When it happens
Trigger: Calling the PHP client's method that serializes inputProps (startRender/renderMedia/renderStill) with a payload that is not JSON-serializable, is too large, contains circular references, references a non-existent region, lacks AWS credentials, or when the target S3 bucket cannot be created/used.
Common situations: Passing PHP objects/Closures/resources as inputProps; passing huge base64 strings; misconfigured AWS region/credentials in the PHPClient; permissions denied on bucket creation; pre-existing bucket ownership mismatch.
Related errors
- Failed to upload to S3: {$exception->getMessage()}
- Failed to serialize input properties for rendering: {e}
- Deploying the site failed, and removing the generated bundle
- failed to upload inputProps to S3: %w
- You have multiple buckets (%s) in your S3 region (%s) starti
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/a5b1c22d132f6fba.
Report an issue: GitHub.