{"record":{"id":"fe3cbcace4a1a6cc","repo":"benbjohnson/litestream","slug":"put-lock-file-w","errorCode":null,"errorMessage":"put lock file: %w","messagePattern":"put lock file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"s3/leaser.go","lineNumber":257,"sourceCode":"\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) {\n\t\t\treturn \"\", &litestream.LeaseExistsError{}\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"put lock file: %w\", err)\n\t}\n\n\tnewETag := \"\"\n\tif out.ETag != nil {\n\t\tnewETag = *out.ETag\n\t}\n\n\treturn newETag, nil\n}\n\nfunc isPreconditionFailed(err error) bool {\n\tvar apiErr smithy.APIError\n\tif errors.As(err, &apiErr) {\n\t\tcode := apiErr.ErrorCode()\n\t\treturn code == \"PreconditionFailed\" || code == \"412\"\n\t}\n\n\tvar respErr *smithy.OperationError","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/s3/leaser.go#L239-L275","documentation":"writeLease's conditional PutObject failed with an error other than precondition-failed (which maps to LeaseExistsError). S3 rejected writing the lease object: connectivity, put permission, or bucket-level issues.","triggerScenarios":"Thrown at s3/leaser.go:257 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify PutObject permission on the lease key","Check S3 connectivity and retry acquisition"],"exampleFix":null,"handlingStrategy":"retry","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-14T05:17:10.506Z"}