thanos-io/thanos · error
copying
Error message
copying
What it means
Wraps io.Copy feeding the file into the sha256 hasher in CalculateHash: reading the file's bytes failed mid-stream (I/O error, file truncated concurrently). The partial digest is discarded and hashing fails.
Solutions
- Check disk health for read errors
- Verify the file is not truncated or concurrently written
- Retry hashing the file
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/block/metadata/hash.go:54 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/3ad1195670b97f72.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/block/metadata/hash.go:54
// Equal returns true if two hashes are equal.
func (oh *ObjectHash) Equal(other *ObjectHash) bool {
return oh.Value == other.Value
}
// CalculateHash calculates the hash of the given type.
func CalculateHash(p string, hf HashFunc, logger log.Logger) (ObjectHash, error) {
switch hf {
case SHA256Func:
f, err := os.Open(filepath.Clean(p))
if err != nil {
return ObjectHash{}, errors.Wrap(err, "opening file")
}
defer runutil.CloseWithLogOnErr(logger, f, "closing %s", p)
h := sha256.New()
if _, err := io.Copy(h, f); err != nil {
return ObjectHash{}, errors.Wrap(err, "copying")
}
return ObjectHash{
Func: SHA256Func,
Value: hex.EncodeToString(h.Sum(nil)),
}, nil
}
return ObjectHash{}, fmt.Errorf("hash function %v is not supported", hf)
}
View on GitHub (pinned to 35b8b99117)