thanos-io/thanos · error
read compressed config file
Error message
read compressed config file
What it means
Wraps io.ReadAll(zr) in Reloader.normalize: the gzip header was valid but reading the decompressed config content to EOF failed mid-stream (truncated or corrupt archive). The expanded bytes are discarded.
Solutions
- Regenerate the gzipped rule/config file.
- Check disk/network integrity of the source.
- Validate the gzip archive with gzip -t.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/reloader/reloader.go:377 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/906b43c1bcd0464c.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/reloader/reloader.go:377
}
func (r *Reloader) normalize(inputFile, outputFile string) error {
b, err := os.ReadFile(inputFile)
if err != nil {
return errors.Wrap(err, "read file")
}
// Detect and extract gzipped file.
if bytes.Equal(b[0:3], firstGzipBytes) {
zr, err := gzip.NewReader(bytes.NewReader(b))
if err != nil {
return errors.Wrap(err, "create gzip reader")
}
defer runutil.CloseWithLogOnErr(r.logger, zr, "gzip reader close")
b, err = io.ReadAll(zr)
if err != nil {
return errors.Wrap(err, "read compressed config file")
}
}
b, err = r.expandEnv(b)
if err != nil {
return errors.Wrap(err, "expand environment variables")
}
tmpFile := outputFile + ".tmp"
defer func() {
_ = os.Remove(tmpFile)
}()
if err := os.WriteFile(tmpFile, b, 0644); err != nil {
return errors.Wrap(err, "write file")
}
if err := os.Rename(tmpFile, outputFile); err != nil {
return errors.Wrap(err, "rename file")
}View on GitHub (pinned to 35b8b99117)