thanos-io/thanos · error

rewrite configuration should be provided

Error message

rewrite configuration should be provided

What it means

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.

Solutions

  1. Add at least one modification flag: --delete series (yaml of series selectors) or --rewrite (relabel config yaml).
  2. Verify flag names are spelled correctly and actually parsed by the command.
  3. If you only intended to inspect blocks, use `thanos tools bucket verify` or `inspect` instead of rewrite.

Example fix

// before
thanos tools bucket rewrite --objstore.bucket=my-bucket 0J2J4... 
// after
thanos tools bucket rewrite --objstore.bucket=my-bucket \
  --delete series="up" 0J2J4...
Defensive patterns

Strategy: validation

Validate before calling

if deletions == nil && relabelConfig == nil {
    return errors.New("bucket rewrite requires --delete series or --rewrite")
}

Prevention

When it happens

Trigger: Running `thanos tools bucket rewrite` without providing any --delete series or --rewrite relabel flags, so that len(modifiers) == 0 after command setup.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/4866d20ba3a06d71. Report an issue: GitHub.

Appendix: source

Thrown at cmd/thanos/tools_bucket.go:1222

				return err
			}
			modifiers = append(modifiers, compactv2.WithRelabelModifier(relabels...))
		}

		deletionsYaml, err := toDelete.Content()
		if err != nil {
			return err
		}
		var deletions []metadata.DeletionRequest
		if len(deletionsYaml) > 0 {
			if err := yaml.Unmarshal(deletionsYaml, &deletions); err != nil {
				return err
			}
			modifiers = append(modifiers, compactv2.WithDeletionModifier(deletions...))
		}

		if len(modifiers) == 0 {
			return errors.New("rewrite configuration should be provided")
		}

		var ids []ulid.ULID
		for _, id := range tbc.blockIDs {
			u, err := ulid.Parse(id)
			if err != nil {
				return errors.Errorf("id is not a valid block ULID, got: %v", id)
			}
			ids = append(ids, u)
		}

		if err := os.RemoveAll(tbc.tmpDir); err != nil {
			return err
		}
		if err := os.MkdirAll(tbc.tmpDir, os.ModePerm); err != nil {
			return err
		}

View on GitHub (pinned to 35b8b99117)