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

  1. Inspect the swallowed $e->getMessage() by temporarily rethrowing it (throw $e) to identify the real root cause before the generic message replaces it.
  2. Ensure inputProps contain only scalar/array data; json_encode the payload yourself first and check json_last_error_msg() before calling render.
  3. If props are large, confirm the bucket exists and the configured region/credentials are correct, since uploadToS3 failures are masked by this same message.
  4. 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

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


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/a5b1c22d132f6fba. Report an issue: GitHub.