{"record":{"id":"ac47fa40f2c63c60","repo":"remotion-dev/remotion","slug":"could-not-parse-progress-for-render-q-w","errorCode":null,"errorMessage":"could not parse progress for render %q: %w","messagePattern":"could not parse progress for render %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/lambda-go/s3.go","lineNumber":99,"sourceCode":"\tprogressObject, err := client.GetObject(context.TODO(), &s3.GetObjectInput{\n\t\tBucket: new(input.BucketName),\n\t\tKey:    new(overallProgressKey(input.RenderId)),\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not read progress for render %q: %w\", input.RenderId, err)\n\t}\n\tdefer progressObject.Body.Close()\n\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}","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/lambda-go/s3.go#L81-L117","documentation":"Go client error from cancelRenderOnLambda: the downloaded progress.json bytes could not be unmarshalled into the {CancellationEnabled bool} struct. The object at renders/<renderId>/progress.json exists but is not valid JSON or not an object (e.g. an XML error document, an empty file, or a truncated body).","triggerScenarios":"The progress key was overwritten or corrupted; another process wrote a non-JSON payload under the same key; the render wrote with a different/older progress schema that is not a JSON object.","commonSituations":"Version skew between the Go client and the deployed Remotion Lambda that produced progress.json; manual tampering with the bucket layout; S3 error XML stored at the key by a buggy integration.","solutions":["Download renders/<renderId>/progress.json manually (`aws s3 cp`) and inspect its contents to see what is actually stored.","Align versions: make sure the @remotion/lambda function deployed and the lambda-go client major versions match.","If the render state is corrupt, abandon this renderId and start a new render with enableCancellation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Sanity-check the progress payload before relying on cancellation\nout, err := client.GetObject(ctx, &s3.GetObjectInput{Bucket: ptr(bucket), Key: ptr(key)})\nbody, _ := io.ReadAll(out.Body)\nvar probe map[string]any\nif json.Unmarshal(body, &probe) != nil { /* corrupt state: do not cancel, alert */ }","typeGuard":"func isProgressJSON(body []byte) bool {\n  var p struct{ CancellationEnabled bool `json:\"cancellationEnabled\"` }\n  return json.Unmarshal(body, &p) == nil\n}","tryCatchPattern":"if err := client.CancelRenderOnLambda(ctx, input); err != nil {\n  if strings.Contains(err.Error(), \"could not parse progress\") {\n    // bucket state corrupt: re-render rather than cancel\n  } else { return err }\n}","preventionTips":["Keep the lambda-go client and the deployed @remotion/lambda function on matching major versions.","Do not write custom objects under renders/<renderId>/progress.json."],"tags":["go","json","s3","cancellation"],"backgroundTag":"json-parse-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"}