remotion-dev/remotion · warning

could not serialize cancellation signal: %w

Error message

could not serialize cancellation signal: %w

What it means

Go client error from cancelRenderOnLambda: json.Marshal of the small map {"cancelledAt": <unix-milli>} failed. In practice this error is nearly unreachable — encoding/json cannot fail on map[string]int64 — so seeing it indicates something highly unusual like a custom json.Marshaler replacement or memory corruption.

Source

Thrown at packages/lambda-go/s3.go:107

	progressBody, err := io.ReadAll(progressObject.Body)
	if err != nil {
		return fmt.Errorf("could not read progress for render %q: %w", input.RenderId, err)
	}

	var progress struct {
		CancellationEnabled bool `json:"cancellationEnabled"`
	}
	if err := json.Unmarshal(progressBody, &progress); err != nil {
		return fmt.Errorf("could not parse progress for render %q: %w", input.RenderId, err)
	}
	if !progress.CancellationEnabled {
		return fmt.Errorf("cannot cancel render %s: the render was not started with enableCancellation: true", input.RenderId)
	}

	cancellationBody, err := json.Marshal(map[string]int64{"cancelledAt": time.Now().UnixMilli()})
	if err != nil {
		return fmt.Errorf("could not serialize cancellation signal: %w", err)
	}
	_, err = client.PutObject(context.TODO(), &s3.PutObjectInput{
		Bucket:      new(input.BucketName),
		Key:         new(cancellationKey(input.RenderId)),
		Body:        strings.NewReader(string(cancellationBody)),
		ContentType: new("application/json"),
	})
	if err != nil {
		return fmt.Errorf("could not cancel render %q: %w", input.RenderId, err)
	}

	return nil
}

// newS3Client creates an S3 client using the same shared config resolution as
// the Lambda client in invocations.go.
func newS3Client(region string, forcePathStyle bool) (*s3.Client, error) {
	awsConfig, err := config.LoadDefaultConfig(

View on GitHub (pinned to 10db9de073)

Solutions

  1. Report it as a bug with reproduction details — this path should not fail in a standard Go toolchain.
  2. Ensure no custom json replacements (linker hacks, marshaler overrides) are in the build.
Defensive patterns

Strategy: try-catch

Try / catch

if err := client.CancelRenderOnLambda(ctx, input); err != nil {
  if strings.Contains(err.Error(), "could not serialize cancellation signal") {
    // effectively unreachable: report upstream
  }
  return err
}

Prevention

When it happens

Trigger: Effectively unreachable in normal operation; would require a replaced/global JSON marshaler that errors, or runtime-level anomalies.

Common situations: Almost never seen; if reported, look for exotic patches to encoding/json or a forked client.

Related errors


AI-assisted analysis of remotion-dev/remotion@10db9de073 (2026-08-22). Data as JSON: /api/errors/27ac0d2c91633604. Report an issue: GitHub.