thanos-io/thanos · error
write file
Error message
write file
What it means
Wraps os.WriteFile of the .tmp staging file in Reloader.normalize: the normalized config could not be written next to the output path (permissions, full disk). Atomic replacement of the output file cannot proceed, so the reload cycle fails and retries.
Solutions
- Check the output directory exists and is writable.
- Free disk space if full.
- Verify the cfg-output-file flag points to a valid path.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/reloader/reloader.go:391 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/4590bf9973e04289.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/reloader/reloader.go:391
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")
}
return nil
}
// apply triggers Prometheus reload if rules or config changed. If cfgOutputFile is set, we also
// expand env vars into config file before reloading.
// Reload is retried in retryInterval until watchInterval.
func (r *Reloader) apply(ctx context.Context) error {
var (
cfgHash []byte
watchedDirsHash []byte
)
if r.cfgFile != "" {
h := sha256.New()View on GitHub (pinned to 35b8b99117)