remotion-dev/remotion · error · error

could not serialize progress parameters: %w

Error message

could not serialize progress parameters: %w

What it means

Returned by invokeRenderProgressLambda when json.Marshal fails on the internal progress parameters built by constructGetProgressInternals. The %w wraps the encoding/json error, which typically means a value of an unsupported type (channel, func, complex, or an infinitely-recursive struct) ended up inside the struct being marshaled. Because the parameters are constructed by the library, this usually indicates a version mismatch between the Go client and the deployed Lambda function.

Source

Thrown at packages/lambda-go/invocations.go:77

	awsConfig, configError := awsconfig.LoadDefaultConfig(
		context.Background(),
		awsconfig.WithRegion(config.Region),
	)
	if configError != nil {
		return nil, fmt.Errorf("could not load AWS config: %w", configError)
	}
	svc := lambda.NewFromConfig(awsConfig)

	internalParams, validateError := constructGetProgressInternals(&config)

	if validateError != nil {
		return nil, validateError
	}

	internalParamsJSON, marshallingError := json.Marshal(internalParams)
	if marshallingError != nil {
		return nil, fmt.Errorf("could not serialize progress parameters: %w", marshallingError)
	}

	invocationParams := &lambda.InvokeInput{
		FunctionName: new(config.FunctionName),
		Payload:      internalParamsJSON,
	}

	// Invoke Lambda function
	invokeResult, invokeError := svc.Invoke(context.Background(), invocationParams)

	if invokeError != nil {
		return nil, fmt.Errorf("could not invoke Lambda function %q: %w", config.FunctionName, invokeError)
	}

	// Unmarshal response from Lambda function
	var renderProgressOutput RenderProgress

	resultUnmarshallError := json.Unmarshal(invokeResult.Payload, &renderProgressOutput)

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Check the wrapped error: `&json.UnsupportedTypeError{Type: ...}` tells you exactly which field is at fault.
  2. Make sure the lambda-go version matches the deployed Remotion Lambda function version (`npx remotion lambda versions`).
  3. If you maintain a fork, ensure every field on the internals struct is a JSON-safe type (string, number, bool, slice, map[string]X, pointer).
  4. Add `json:"-"` tags to any field that must not be serialized.

Example fix

// before
type progressInternals struct {
    Callback *func() error // json.Marshal fails on func type
}

// after
type progressInternals struct {
    CallbackURL string `json:"callbackUrl"`
}
Defensive patterns

Strategy: try-catch

Try / catch

progress, err := client.GetRenderProgress(ctx, cfg)
if err != nil {
    var typeErr *json.UnsupportedTypeError
    if errors.As(err, &typeErr) {
        // library internals are not serializable: version mismatch with deployed function
        log.Printf("progress params cannot be serialized: %s - realign lambda-go and deployed function versions", typeErr.Type)
    }
    return nil, err
}

Prevention

When it happens

Trigger: The progress-params struct contains a field that encoding/json cannot serialize — e.g. a func value, a chan, or a self-referential struct with no json tag to break the cycle. Also seen when a struct field is of type complex128 or an unsupported map key type.

Common situations: Upgrading lambda-go without redeploying the Remotion Lambda function, so the client sends a struct shape the function no longer expects. Forking the library and adding a non-marshalable field to the internals struct. Passing an unexported type through json.Marshal that json cannot see.

Related errors


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