{"record":{"id":"735510c86a1c7b33","repo":"remotion-dev/remotion","slug":"could-not-serialize-render-parameters-w","errorCode":null,"errorMessage":"could not serialize render parameters: %w","messagePattern":"could not serialize render parameters: %w","errorType":"exception","errorClass":"error","httpStatus":null,"severity":"error","filePath":"packages/lambda-go/invocations.go","lineNumber":31,"sourceCode":"\n\tawsConfig, configError := awsconfig.LoadDefaultConfig(\n\t\tcontext.Background(),\n\t\tawsconfig.WithRegion(options.Region),\n\t)\n\tif configError != nil {\n\t\treturn nil, fmt.Errorf(\"could not load AWS config: %w\", configError)\n\t}\n\tsvc := lambda.NewFromConfig(awsConfig)\n\n\tinternalParams, validateError := constructRenderInternals(&options)\n\n\tif validateError != nil {\n\t\treturn nil, validateError\n\t}\n\n\tinternalParamJsonObject, marshallingError := json.Marshal(internalParams)\n\tif marshallingError != nil {\n\t\treturn nil, fmt.Errorf(\"could not serialize render parameters: %w\", marshallingError)\n\t}\n\n\tinvocationPayload := &lambda.InvokeInput{\n\t\tFunctionName: new(options.FunctionName),\n\t\tPayload:      internalParamJsonObject,\n\t}\n\n\t// Invoke Lambda function\n\tinvocationResult, invocationError := svc.Invoke(context.Background(), invocationPayload)\n\n\tif invocationError != nil {\n\t\treturn nil, fmt.Errorf(\"could not invoke Lambda function %q: %w\", options.FunctionName, invocationError)\n\t}\n\n\t// Unmarshal response from Lambda function\n\tvar renderResponseOutput RemotionRenderResponse\n\n\tresponseMarshallingError := json.Unmarshal(invocationResult.Payload, &renderResponseOutput)","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-go/invocations.go#L13-L49","documentation":"Returned by invokeRenderLambda() in lambda-go when json.Marshal fails to serialize the internal render parameters built by constructRenderInternals(). Marshal fails on unsupported types (channels, functions, circular references) or on a custom MarshalJSON method that returns an error.","triggerScenarios":"A field on RemotionOptions or its internal representation that contains a non-serializable Go value, a circular reference, or a custom MarshalJSON that errors; passing an InputProps struct with unexported fields that JSON tags cannot reach.","commonSituations":"Extending RemotionOptions with a custom field whose type cannot marshal; embedding a function value or sync.Mutex (which has no JSON representation); a bug in a custom MarshalJSON implementation.","solutions":["Inspect the wrapped error (fmt.Printf(\"%+v\", err)) to identify the offending field/type.","Ensure every field on the params struct is a JSON-serializable type (primitives, slices, maps, structs, pointers to those).","Add `json:\"-\"` tags to non-serializable helper fields (mutexes, channels, function values)."],"exampleFix":"// before\ntype RemotionOptions struct {\n    FunctionName string\n    OnProgress   func(int) `json:\"onProgress\"` // cannot marshal a func\n}\n\n// after\ntype RemotionOptions struct {\n    FunctionName string\n    OnProgress   func(int) `json:\"-\"`\n}","handlingStrategy":"try-catch","validationCode":"// Validate that the options struct is JSON-serializable at startup.\nif _, err := json.Marshal(opts); err != nil { log.Fatalf(\"opts not serializable: %v\", err) }","typeGuard":null,"tryCatchPattern":"resp, err := lambda_go_sdk.RenderMedia(opts)\nif err != nil {\n  var jse *json.UnsupportedTypeError\n  if errors.As(err, &jse) { /* offending field type */ }\n}","preventionTips":["Keep RemotionOptions fields to JSON-safe types; tag non-serializable helpers with `json:\"-\"`.","Add a marshalling unit test for any custom struct passed into the SDK.","Audit custom MarshalJSON implementations for error paths."],"tags":["lambda-go","go","json","serialization"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}