{"record":{"id":"2f0bbe429cef9313","repo":"thanos-io/thanos","slug":"unexpected-downsampling-resolution-d","errorCode":null,"errorMessage":"unexpected downsampling resolution %d","messagePattern":"unexpected downsampling resolution (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/downsample.go","lineNumber":224,"sourceCode":"\t// mapping from a hash over all source IDs to blocks. We don't need to downsample a block\n\t// if a downsampled version with the same hash already exists.\n\tsources5m := map[ulid.ULID]struct{}{}\n\tsources1h := map[ulid.ULID]struct{}{}\n\n\tfor _, m := range metas {\n\t\tswitch m.Thanos.Downsample.Resolution {\n\t\tcase downsample.ResLevel0:\n\t\t\tcontinue\n\t\tcase downsample.ResLevel1:\n\t\t\tfor _, id := range m.Compaction.Sources {\n\t\t\t\tsources5m[id] = struct{}{}\n\t\t\t}\n\t\tcase downsample.ResLevel2:\n\t\t\tfor _, id := range m.Compaction.Sources {\n\t\t\t\tsources1h[id] = struct{}{}\n\t\t\t}\n\t\tdefault:\n\t\t\treturn errors.Errorf(\"unexpected downsampling resolution %d\", m.Thanos.Downsample.Resolution)\n\t\t}\n\t}\n\n\tignoreDirs := []string{}\n\tfor ulid := range metas {\n\t\tignoreDirs = append(ignoreDirs, ulid.String())\n\t}\n\n\tif err := runutil.DeleteAll(dir, ignoreDirs...); err != nil {\n\t\tlevel.Warn(logger).Log(\"msg\", \"failed deleting potentially outdated directories/files, some disk space usage might have leaked. Continuing\", \"err\", err, \"dir\", dir)\n\t}\n\n\tmetasULIDS := make([]ulid.ULID, 0, len(metas))\n\tfor k := range metas {\n\t\tmetasULIDS = append(metasULIDS, k)\n\t}\n\tsort.Slice(metasULIDS, func(i, j int) bool {\n\t\treturn metasULIDS[i].Compare(metasULIDS[j]) < 0","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/downsample.go#L206-L242","documentation":"downsampleBucket scans existing block metas to decide which source blocks to ignore, and errors with errors.Errorf when a block's meta.Thanos.Downsample.Resolution is not one of the known levels (0, ResLevel1=5m, ResLevel2=60m). This indicates a meta.json with a corrupted or unknown downsampling resolution value.","triggerScenarios":"A block in the bucket has meta.json whose thanos.downsample.resolution is neither 0, 300000, nor 3600000 — e.g. a hand-edited or corrupted meta, or a block written by an incompatible/future version with a new resolution level.","commonSituations":"Manually copying blocks between buckets and editing meta.json; blocks produced by a patched/older Thanos with different resolution encoding; truncated meta.json uploads from failed uploads.","solutions":["Identify the offending block (log/scan its meta.json thanos.downsample.resolution) and delete or re-upload a correct meta.json for it.","Check the Thanos version that wrote the block; upgrade the running downsample binary to match the bucket's block versions.","If meta.json is corrupted, remove the partial block from the object store so the compactor/downsampler can reprocess sources."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var resolution int64\nif err := json.Unmarshal(meta.Thanos.Downsample.Resolution, &resolution); err != nil { /* corrupt */ }\nswitch resolution {\ncase 0, 300000, 3600000:\ndefault:\n    log.Printf(\"block %s has invalid resolution %d\", meta.ULID, resolution)\n}","typeGuard":"func validResolution(r int64) bool { return r == 0 || r == 300000 || r == 3600000 }","tryCatchPattern":null,"preventionTips":["Never hand-edit block meta.json files; regenerate blocks instead.","Keep Thanos versions homogeneous between writers (compactors/receivers) and readers.","Periodically audit bucket metas with a script that flags unknown resolution values."],"tags":["block-metadata","validation","enum"],"backgroundTag":"invalid-enum-value","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"}