{"record":{"id":"906b43c1bcd0464c","repo":"thanos-io/thanos","slug":"read-compressed-config-file","errorCode":null,"errorMessage":"read compressed config file","messagePattern":"read compressed config file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/reloader/reloader.go","lineNumber":377,"sourceCode":"}\n\nfunc (r *Reloader) normalize(inputFile, outputFile string) error {\n\tb, err := os.ReadFile(inputFile)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"read file\")\n\t}\n\n\t// Detect and extract gzipped file.\n\tif bytes.Equal(b[0:3], firstGzipBytes) {\n\t\tzr, err := gzip.NewReader(bytes.NewReader(b))\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"create gzip reader\")\n\t\t}\n\t\tdefer runutil.CloseWithLogOnErr(r.logger, zr, \"gzip reader close\")\n\n\t\tb, err = io.ReadAll(zr)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"read compressed config file\")\n\t\t}\n\t}\n\n\tb, err = r.expandEnv(b)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"expand environment variables\")\n\t}\n\n\ttmpFile := outputFile + \".tmp\"\n\tdefer func() {\n\t\t_ = os.Remove(tmpFile)\n\t}()\n\tif err := os.WriteFile(tmpFile, b, 0644); err != nil {\n\t\treturn errors.Wrap(err, \"write file\")\n\t}\n\tif err := os.Rename(tmpFile, outputFile); err != nil {\n\t\treturn errors.Wrap(err, \"rename file\")\n\t}","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/reloader/reloader.go#L359-L395","documentation":"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.","triggerScenarios":"Thrown at pkg/reloader/reloader.go:377 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Regenerate the gzipped rule/config file.","Check disk/network integrity of the source.","Validate the gzip archive with gzip -t."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}