thanos-io/thanos · error

no ignore chunk function specified

Error message

no ignore chunk function specified

What it means

block.Repair requires at least one ignoreChkFn (a predicate deciding which chunks to keep/drop). It rejects the call with "no ignore chunk function specified" rather than guessing a repair policy. This is a caller programming error, not a data problem.

Solutions

  1. Pass at least one ignore function, e.g. block.IgnoreIssue347OutsideChunks when repairing tsdb issue 347 outsiders
  2. Supply caller-appropriate filters explicitly in your repair wrapper
  3. Return a validation error early if no filters are configured

Example fix

// before
resid, err := block.Repair(ctx, logger, dir, id, source) // panics with error: no ignore chunk function specified
// after
resid, err := block.Repair(ctx, logger, dir, id, source, block.IgnoreIssue347OutsideChunks)
Defensive patterns

Strategy: validation

Validate before calling

if len(ignoreChkFns) == 0 {
    ignoreChkFns = []block.IgnoreFn{block.IgnoreIssue347OutsideChunks}
}

Try / catch

if len(ignoreChkFns) == 0 {
    return ulid.ULID{}, errors.New("repair requires at least one ignore chunk function")
}
resid, err := block.Repair(ctx, logger, dir, id, source, ignoreChkFns...)

Prevention

When it happens

Trigger: Calling Repair(ctx, logger, dir, id, source) with an empty ignoreChkFns variadic list — e.g. passing through user-supplied filters without a default.

Common situations: Custom tooling invoking block.Repair directly, wrappers forgetting to append default ignore functions like block.IgnoreIssue347OutsideChunks.

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/88ffe27e666753d3. Report an issue: GitHub.

Appendix: source

Thrown at pkg/block/index.go:417

	stats.ChunkMaxDuration = time.Duration(chunkDuration.max) * time.Millisecond
	stats.ChunkAvgDuration = time.Duration(chunkDuration.Avg()) * time.Millisecond
	stats.ChunkMinDuration = time.Duration(chunkDuration.min) * time.Millisecond
	return stats, nil
}

type ignoreFnType func(mint, maxt int64, prev *chunks.Meta, curr *chunks.Meta) (bool, error)

// Repair open the block with given id in dir and creates a new one with fixed data.
// It:
// - removes out of order duplicates
// - all "complete" outsiders (they will not accessed anyway)
// - removes all near "complete" outside chunks introduced by https://github.com/prometheus/tsdb/issues/347.
// Fixable inconsistencies are resolved in the new block.
// TODO(bplotka): https://github.com/thanos-io/thanos/issues/378.
func Repair(ctx context.Context, logger log.Logger, dir string, id ulid.ULID, source metadata.SourceType, ignoreChkFns ...ignoreFnType) (resid ulid.ULID, err error) {
	if len(ignoreChkFns) == 0 {
		return resid, errors.New("no ignore chunk function specified")
	}

	bdir := filepath.Join(dir, id.String())
	entropy := rand.New(rand.NewSource(time.Now().UnixNano()))
	resid = ulid.MustNew(ulid.Now(), entropy)

	meta, err := metadata.ReadFromDir(bdir)
	if err != nil {
		return resid, errors.Wrap(err, "read meta file")
	}
	if meta.Thanos.Downsample.Resolution > 0 {
		return resid, errors.New("cannot repair downsampled block")
	}

	b, err := tsdb.OpenBlock(logutil.GoKitLogToSlog(logger), bdir, nil, nil)
	if err != nil {
		return resid, errors.Wrap(err, "open block")
	}

View on GitHub (pinned to 35b8b99117)