{"record":{"id":"fe3848f7934e986e","repo":"jaegertracing/jaeger","slug":"only-one-of-tagindexblacklist-and-tagindexwhitelis","errorCode":null,"errorMessage":"only one of TagIndexBlacklist and TagIndexWhitelist can be specified","messagePattern":"only one of TagIndexBlacklist and TagIndexWhitelist can be specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v2/cassandra/factory.go","lineNumber":160,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn b.f, nil\n}\n\nfunc writerOptions(opts *cassandra.Options) ([]cspanstore.Option, error) {\n\tvar tagFilters []dbmodel.TagFilter\n\n\t// drop all tag filters\n\tif !opts.Index.Tags || !opts.Index.ProcessTags || !opts.Index.Logs {\n\t\ttagFilters = append(tagFilters, dbmodel.NewTagFilterDropAll(!opts.Index.Tags, !opts.Index.ProcessTags, !opts.Index.Logs))\n\t}\n\n\t// black/white list tag filters\n\ttagIndexBlacklist := opts.TagIndexBlacklist()\n\ttagIndexWhitelist := opts.TagIndexWhitelist()\n\tif len(tagIndexBlacklist) > 0 && len(tagIndexWhitelist) > 0 {\n\t\treturn nil, errors.New(\"only one of TagIndexBlacklist and TagIndexWhitelist can be specified\")\n\t}\n\tif len(tagIndexBlacklist) > 0 {\n\t\ttagFilters = append(tagFilters, dbmodel.NewBlacklistFilter(tagIndexBlacklist))\n\t} else if len(tagIndexWhitelist) > 0 {\n\t\ttagFilters = append(tagFilters, dbmodel.NewWhitelistFilter(tagIndexWhitelist))\n\t}\n\n\tif len(tagFilters) == 0 {\n\t\treturn nil, nil\n\t} else if len(tagFilters) == 1 {\n\t\treturn []cspanstore.Option{cspanstore.TagFilter(tagFilters[0])}, nil\n\t}\n\n\treturn []cspanstore.Option{cspanstore.TagFilter(dbmodel.NewChainedTagFilter(tagFilters...))}, nil\n}\n","sourceCodeStart":142,"sourceCodeEnd":176,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v2/cassandra/factory.go#L142-L176","documentation":"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.","triggerScenarios":"Constructing a Cassandra trace writer with an options object where both TagIndexBlacklist() and TagIndexWhitelist() return non-empty lists.","commonSituations":"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.","solutions":["Remove either the TagIndexBlacklist or the TagIndexWhitelist option, keeping only one","Check for config-file and flag overrides both setting tag-index options","Inspect how the options struct is built in your factory/bootstrap code to see where both lists are populated"],"exampleFix":"// before\nopts.TagIndexBlacklist([]string{\"internal\"}).TagIndexWhitelist([]string{\"http.method\"})\n// after\nopts.TagIndexWhitelist([]string{\"http.method\"}) // keep only one list","handlingStrategy":"validation","validationCode":"if len(cfg.TagIndexBlacklist) > 0 && len(cfg.TagIndexWhitelist) > 0 {\n    return errors.New(\"configure only one of TagIndexBlacklist and TagIndexWhitelist\")\n}","typeGuard":"func exactlyOneListSet(bl, wl []string) bool {\n    return (len(bl) > 0) != (len(wl) > 0)\n}","tryCatchPattern":"writer, err := factory.CreateTraceWriter()\nif err != nil && strings.Contains(err.Error(), \"only one of TagIndexBlacklist\") {\n    // fix configuration: keep exactly one of the two lists\n}","preventionTips":["Audit merged config (file + flags) for both options being set","Use a single config field/tag-index-mode enum instead of two lists in your own wrapper","Validate options before calling CreateTraceWriter"],"tags":["cassandra","configuration","jaeger"],"backgroundTag":"mutually-exclusive-config-options","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}