{"record":{"id":"4866d20ba3a06d71","repo":"thanos-io/thanos","slug":"rewrite-configuration-should-be-provided","errorCode":null,"errorMessage":"rewrite configuration should be provided","messagePattern":"rewrite configuration should be provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/tools_bucket.go","lineNumber":1222,"sourceCode":"\t\t\t\treturn err\n\t\t\t}\n\t\t\tmodifiers = append(modifiers, compactv2.WithRelabelModifier(relabels...))\n\t\t}\n\n\t\tdeletionsYaml, err := toDelete.Content()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar deletions []metadata.DeletionRequest\n\t\tif len(deletionsYaml) > 0 {\n\t\t\tif err := yaml.Unmarshal(deletionsYaml, &deletions); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tmodifiers = append(modifiers, compactv2.WithDeletionModifier(deletions...))\n\t\t}\n\n\t\tif len(modifiers) == 0 {\n\t\t\treturn errors.New(\"rewrite configuration should be provided\")\n\t\t}\n\n\t\tvar ids []ulid.ULID\n\t\tfor _, id := range tbc.blockIDs {\n\t\t\tu, err := ulid.Parse(id)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Errorf(\"id is not a valid block ULID, got: %v\", id)\n\t\t\t}\n\t\t\tids = append(ids, u)\n\t\t}\n\n\t\tif err := os.RemoveAll(tbc.tmpDir); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := os.MkdirAll(tbc.tmpDir, os.ModePerm); err != nil {\n\t\t\treturn err\n\t\t}\n","sourceCodeStart":1204,"sourceCodeEnd":1240,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/tools_bucket.go#L1204-L1240","documentation":"This error is thrown by the `thanos tools bucket rewrite` command when neither a deletion modifier (via --delete series) nor a relabel modifier (via --rewrite) was configured. The rewrite command modifies existing blocks and refuses to run with zero modifiers because it would be a no-op (or worse, a pointless block re-upload). It is a guard against a misconfigured invocation that could churn the object store without changing anything.","triggerScenarios":"Running `thanos tools bucket rewrite` without providing any --delete series or --rewrite relabel flags, so that len(modifiers) == 0 after command setup.","commonSituations":"Operators invoking the rewrite subcommand with only --objstore flags and block IDs, forgetting the actual modification flags; scripting the tool and building the flag list dynamically so the modification flags end up empty; typos in flag names causing them to be ignored.","solutions":["Add at least one modification flag: --delete series (yaml of series selectors) or --rewrite (relabel config yaml).","Verify flag names are spelled correctly and actually parsed by the command.","If you only intended to inspect blocks, use `thanos tools bucket verify` or `inspect` instead of rewrite."],"exampleFix":"// before\nthanos tools bucket rewrite --objstore.bucket=my-bucket 0J2J4... \n// after\nthanos tools bucket rewrite --objstore.bucket=my-bucket \\\n  --delete series=\"up\" 0J2J4...","handlingStrategy":"validation","validationCode":"if deletions == nil && relabelConfig == nil {\n    return errors.New(\"bucket rewrite requires --delete series or --rewrite\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass at least one modification flag to rewrite","Script the command with an assertion that the modification flags array is non-empty"],"tags":["cli","thanos","block-rewrite","missing-configuration"],"backgroundTag":"missing-required-argument","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"}