{"record":{"id":"27ac0d2c91633604","repo":"remotion-dev/remotion","slug":"could-not-serialize-cancellation-signal-w","errorCode":null,"errorMessage":"could not serialize cancellation signal: %w","messagePattern":"could not serialize cancellation signal: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/lambda-go/s3.go","lineNumber":107,"sourceCode":"\n\tprogressBody, err := io.ReadAll(progressObject.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not read progress for render %q: %w\", input.RenderId, err)\n\t}\n\n\tvar progress struct {\n\t\tCancellationEnabled bool `json:\"cancellationEnabled\"`\n\t}\n\tif err := json.Unmarshal(progressBody, &progress); err != nil {\n\t\treturn fmt.Errorf(\"could not parse progress for render %q: %w\", input.RenderId, err)\n\t}\n\tif !progress.CancellationEnabled {\n\t\treturn fmt.Errorf(\"cannot cancel render %s: the render was not started with enableCancellation: true\", input.RenderId)\n\t}\n\n\tcancellationBody, err := json.Marshal(map[string]int64{\"cancelledAt\": time.Now().UnixMilli()})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not serialize cancellation signal: %w\", err)\n\t}\n\t_, err = client.PutObject(context.TODO(), &s3.PutObjectInput{\n\t\tBucket:      new(input.BucketName),\n\t\tKey:         new(cancellationKey(input.RenderId)),\n\t\tBody:        strings.NewReader(string(cancellationBody)),\n\t\tContentType: new(\"application/json\"),\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not cancel render %q: %w\", input.RenderId, err)\n\t}\n\n\treturn nil\n}\n\n// newS3Client creates an S3 client using the same shared config resolution as\n// the Lambda client in invocations.go.\nfunc newS3Client(region string, forcePathStyle bool) (*s3.Client, error) {\n\tawsConfig, err := config.LoadDefaultConfig(","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/lambda-go/s3.go#L89-L125","documentation":"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.","triggerScenarios":"Effectively unreachable in normal operation; would require a replaced/global JSON marshaler that errors, or runtime-level anomalies.","commonSituations":"Almost never seen; if reported, look for exotic patches to encoding/json or a forked client.","solutions":["Report it as a bug with reproduction details — this path should not fail in a standard Go toolchain.","Ensure no custom json replacements (linker hacks, marshaler overrides) are in the build."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := client.CancelRenderOnLambda(ctx, input); err != nil {\n  if strings.Contains(err.Error(), \"could not serialize cancellation signal\") {\n    // effectively unreachable: report upstream\n  }\n  return err\n}","preventionTips":["No practical prevention; do not patch or replace encoding/json in service binaries."],"tags":["go","json","cancellation"],"backgroundTag":"json-serialization-error","analyzedSha":"10db9de07356446fb0edb3c3ae211369b693d18b","analyzedAt":"2026-08-22T21:45:17.748Z","contentChangedAt":"2026-08-22T21:45:17.748Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}