jaegertracing/jaeger · error

only one of TagIndexBlacklist and TagIndexWhitelist can be s

Error message

only one of TagIndexBlacklist and TagIndexWhitelist can be specified

What it means

This error is raised by writerOptions (used by CreateTraceWriter) in the Cassandra storage factory when both TagIndexBlacklist and TagIndexWhitelist are configured. The two options are mutually exclusive ways of limiting which tags get indexed, so specifying both is ambiguous.

Source

Thrown at internal/storage/v2/cassandra/factory.go:160

	if err != nil {
		return nil, err
	}
	return b.f, nil
}

func writerOptions(opts *cassandra.Options) ([]cspanstore.Option, error) {
	var tagFilters []dbmodel.TagFilter

	// drop all tag filters
	if !opts.Index.Tags || !opts.Index.ProcessTags || !opts.Index.Logs {
		tagFilters = append(tagFilters, dbmodel.NewTagFilterDropAll(!opts.Index.Tags, !opts.Index.ProcessTags, !opts.Index.Logs))
	}

	// black/white list tag filters
	tagIndexBlacklist := opts.TagIndexBlacklist()
	tagIndexWhitelist := opts.TagIndexWhitelist()
	if len(tagIndexBlacklist) > 0 && len(tagIndexWhitelist) > 0 {
		return nil, errors.New("only one of TagIndexBlacklist and TagIndexWhitelist can be specified")
	}
	if len(tagIndexBlacklist) > 0 {
		tagFilters = append(tagFilters, dbmodel.NewBlacklistFilter(tagIndexBlacklist))
	} else if len(tagIndexWhitelist) > 0 {
		tagFilters = append(tagFilters, dbmodel.NewWhitelistFilter(tagIndexWhitelist))
	}

	if len(tagFilters) == 0 {
		return nil, nil
	} else if len(tagFilters) == 1 {
		return []cspanstore.Option{cspanstore.TagFilter(tagFilters[0])}, nil
	}

	return []cspanstore.Option{cspanstore.TagFilter(dbmodel.NewChainedTagFilter(tagFilters...))}, nil
}

View on GitHub (pinned to 806f444784)

Solutions

  1. Remove either the TagIndexBlacklist or the TagIndexWhitelist option, keeping only one
  2. Check for config-file and flag overrides both setting tag-index options
  3. Inspect how the options struct is built in your factory/bootstrap code to see where both lists are populated

Example fix

// before
opts.TagIndexBlacklist([]string{"internal"}).TagIndexWhitelist([]string{"http.method"})
// after
opts.TagIndexWhitelist([]string{"http.method"}) // keep only one list
Defensive patterns

Strategy: validation

Validate before calling

if len(cfg.TagIndexBlacklist) > 0 && len(cfg.TagIndexWhitelist) > 0 {
    return errors.New("configure only one of TagIndexBlacklist and TagIndexWhitelist")
}

Type guard

func exactlyOneListSet(bl, wl []string) bool {
    return (len(bl) > 0) != (len(wl) > 0)
}

Try / catch

writer, err := factory.CreateTraceWriter()
if err != nil && strings.Contains(err.Error(), "only one of TagIndexBlacklist") {
    // fix configuration: keep exactly one of the two lists
}

Prevention

When it happens

Trigger: Constructing a Cassandra trace writer with an options object where both TagIndexBlacklist() and TagIndexWhitelist() return non-empty lists.

Common situations: Merging configuration from a config file and CLI flags so both options end up set; migrating from a whitelist setup to a blacklist (or vice versa) without removing the old list.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/fe3848f7934e986e. Report an issue: GitHub.