{"record":{"id":"938876d1d21f3423","repo":"remotion-dev/remotion","slug":"error-serializing-inputprops-check-it-has-no-circ","errorCode":null,"errorMessage":"error serializing inputProps. Check it has no circular references or reduce the size if the object is big: %w","messagePattern":"error serializing inputProps\\. Check it has no circular references or reduce the size if the object is big: %w","errorType":"exception","errorClass":"error","httpStatus":null,"severity":"error","filePath":"packages/lambda-go/utils.go","lineNumber":46,"sourceCode":"\tlog.Printf(\n\t\t\"Warning: The props are over %dKB (%dKB) in size. Uploading them to S3 to circumvent the AWS Lambda payload size limit, which may lead to slowdown.\",\n\t\tint(math.Round(float64(maxSize)/1000)), (payloadSize+1023)/1024,\n\t)\n\treturn true\n}\n\nfunc serializeInputProps(inputProps interface{}, region string, inputType string,\n\tuserSpecifiedBucketName string, forcePathStyle bool) (*SerializedInputProps, error) {\n\tif inputProps == nil {\n\t\treturn &SerializedInputProps{\n\t\t\tPayload: \"{}\",\n\t\t\tType:    \"payload\",\n\t\t}, nil\n\t}\n\n\tpayload, err := json.Marshal(inputProps)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error serializing inputProps. Check it has no circular references or reduce the size if the object is big: %w\", err)\n\t}\n\n\tif !needsUpload(len(payload), inputType) {\n\t\treturn &SerializedInputProps{\n\t\t\tPayload: string(payload),\n\t\t\tType:    \"payload\",\n\t\t}, nil\n\t}\n\n\tsvc, err := newS3Client(region, forcePathStyle)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbucketName := userSpecifiedBucketName\n\tif bucketName == \"\" {\n\t\tbucketName, err = getOrCreateBucket(svc, region)\n\t\tif err != nil {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-go/utils.go#L28-L64","documentation":"Returned by serializeInputProps when json.Marshal fails on the caller-supplied inputProps value. Unlike the internal-params case (1181), this is user-provided data, so the most common causes are circular references in the object graph and types Go's encoding/json cannot encode (channels, functions, complex numbers, or maps with non-string keys). The message hints at both circular references and large-object cases.","triggerScenarios":"Passing a struct with a circular pointer graph (A points to B points back to A), a value containing a func or chan field without a json:\"-\" tag, a map with a struct/pointer key, or a value of type complex128.","commonSituations":"Passing live component objects or render context that holds back-references. Marshaling a graph built from a database ORM with bidirectional relationships. Embedding a sync.Mutex or logger inside the props struct.","solutions":["Inspect the wrapped error type: json.UnsupportedTypeError, json.MarshalerError, or 'circular references' (Go's marshaler errors out as 'cyclic data' on infinite recursion).","Break cycles by passing plain DTOs into inputProps — convert ORM/component objects to simple structs first.","Add `json:\"-\"` to fields that hold non-serializable values (channels, funcs, mutexes, loggers).","If the object is legitimately large, split it: store bulk data in S3 yourself and pass a reference URL."],"exampleFix":"// before\ntype props struct {\n    Self  *props      // circular -> json.Marshal loops\n    Log   *log.Logger // unmarshallable\n}\nremotion.Render(inputProps: &props{...})\n\n// after\ntype props struct {\n    Name string `json:\"name\"`\n}\nremotion.Render(inputProps: &props{Name: \"intro\"})","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Reject non-serializable props before calling render.\nfunc isJSONSafe(v interface{}) bool {\n    rv := reflect.ValueOf(v)\n    if !rv.IsValid() { return true }\n    switch rv.Kind() {\n    case reflect.Chan, reflect.Func, reflect.Complex64, reflect.Complex128:\n        return false\n    case reflect.Map:\n        if rv.Type().Key().Kind() != reflect.String { return false }\n    }\n    return true\n}","tryCatchPattern":"payload, err := json.Marshal(inputProps)\nif err != nil {\n    var te *json.UnsupportedTypeError\n    if errors.As(err, &te) {\n        // field of unsupported type - rebuild props as plain DTOs\n    }\n    return nil, err\n}","preventionTips":["Pass plain DTOs (structs of primitives/slices/maps) as inputProps, never live objects.","Tag channels, funcs, mutexes, and loggers with `json:\"-\"`.","Run a json.Marshal round-trip in tests for any new props struct."],"tags":["json","serialization","input-props","circular-reference","go","lambda-go"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}