thanos-io/thanos · error
expand environment variables
Error message
expand environment variables
What it means
Wraps r.expandEnv in Reloader.normalize: expanding environment variables in the config failed, typically an unbalanced ${VAR or other os.Expand syntax problem introduced by a malformed ${...} template in the config.
Solutions
- Define all referenced environment variables in the pod/secret.
- Check for typos or unsupported syntax in ${VAR} placeholders.
- Inspect the wrapped error for the offending variable.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/reloader/reloader.go:383 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/d76286c6db732ad1.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/reloader/reloader.go:383
}
// 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")
}
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.View on GitHub (pinned to 35b8b99117)