{"record":{"id":"9b8cbacd23bae458","repo":"thanos-io/thanos","slug":"create-gzip-reader","errorCode":null,"errorMessage":"create gzip reader","messagePattern":"create gzip reader","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/reloader/reloader.go","lineNumber":371,"sourceCode":"\t\tif err := r.apply(applyCtx); err != nil {\n\t\t\tr.configApplyErrors.Inc()\n\t\t\tlevel.Error(r.logger).Log(\"msg\", \"apply error\", \"err\", err)\n\t\t\tcontinue\n\t\t}\n\t}\n}\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}()","sourceCodeStart":353,"sourceCodeEnd":389,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/reloader/reloader.go#L353-L389","documentation":"Wraps gzip.NewReader in Reloader.normalize: the config file's first bytes match the gzip magic, but a gzip stream cannot be initialized over the content (corrupt header, truncated archive). Decompression of the bundled config fails before env expansion.","triggerScenarios":"Thrown at pkg/reloader/reloader.go:371 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-upload or regenerate the gzipped config.","Verify the source file is a complete gzip archive.","If the config is plain text, fix the leading bytes."],"exampleFix":null,"handlingStrategy":"validation","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"}