{"record":{"id":"5feed24e3fc6d7e0","repo":"benbjohnson/litestream","slug":"marshal-lock-file-w","errorCode":null,"errorMessage":"marshal lock file: %w","messagePattern":"marshal lock file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"s3/leaser.go","lineNumber":236,"sourceCode":"\tif err := json.NewDecoder(out.Body).Decode(&lease); err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"decode lock file: %w\", err)\n\t}\n\n\tetag := \"\"\n\tif out.ETag != nil {\n\t\tetag = *out.ETag\n\t}\n\tlease.ETag = etag\n\n\treturn &lease, etag, nil\n}\n\nfunc (l *Leaser) writeLease(ctx context.Context, lease *litestream.Lease, etag string) (string, error) {\n\tkey := l.lockKey()\n\n\tdata, err := json.Marshal(lease)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"marshal lock file: %w\", err)\n\t}\n\n\tinput := &s3.PutObjectInput{\n\t\tBucket:      aws.String(l.Bucket),\n\t\tKey:         aws.String(key),\n\t\tBody:        bytes.NewReader(data),\n\t\tContentType: aws.String(\"application/json\"),\n\t}\n\n\tif etag == \"\" {\n\t\tinput.IfNoneMatch = aws.String(\"*\")\n\t} else {\n\t\tinput.IfMatch = aws.String(etag)\n\t}\n\n\tout, err := l.s3.PutObject(ctx, input)\n\tif err != nil {\n\t\tif isPreconditionFailed(err) {","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/s3/leaser.go#L218-L254","documentation":"json.Marshal of the litestream.Lease struct failed inside writeLease. This should be unreachable for well-formed Lease values; it indicates an unmarshalable field (e.g. a channel or func injected programmatically) rather than a runtime condition.","triggerScenarios":"Thrown at s3/leaser.go:236 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the Lease struct for unsupported field types","Report as a bug if it occurs with normal lease data"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}