benbjohnson/litestream · error
marshal lock file: %w
Error message
marshal lock file: %w
What it means
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.
Source
Thrown at s3/leaser.go:236
if err := json.NewDecoder(out.Body).Decode(&lease); err != nil {
return nil, "", fmt.Errorf("decode lock file: %w", err)
}
etag := ""
if out.ETag != nil {
etag = *out.ETag
}
lease.ETag = etag
return &lease, etag, nil
}
func (l *Leaser) writeLease(ctx context.Context, lease *litestream.Lease, etag string) (string, error) {
key := l.lockKey()
data, err := json.Marshal(lease)
if err != nil {
return "", fmt.Errorf("marshal lock file: %w", err)
}
input := &s3.PutObjectInput{
Bucket: aws.String(l.Bucket),
Key: aws.String(key),
Body: bytes.NewReader(data),
ContentType: aws.String("application/json"),
}
if etag == "" {
input.IfNoneMatch = aws.String("*")
} else {
input.IfMatch = aws.String(etag)
}
out, err := l.s3.PutObject(ctx, input)
if err != nil {
if isPreconditionFailed(err) {View on GitHub (pinned to 4ed7a308f6)
Solutions
- Inspect the Lease struct for unsupported field types
- Report as a bug if it occurs with normal lease data
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at s3/leaser.go:236 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of benbjohnson/litestream@4ed7a308f6 (2026-09-06).
Data as JSON: /api/errors/5feed24e3fc6d7e0.
Report an issue: GitHub.