jaegertracing/jaeger · error
wrong number of arguments
Error message
wrong number of arguments
What it means
refArg extracts a single span-field reference operand from a predicate call. If the predicate's sole argument is not a reference to a value on the span (asReference fails), the predicate is rejected with tracestore.ErrFilterInvalid because the operator semantically requires reading a field from the span. The error wraps ErrFilterInvalid so callers can distinguish malformed filters from unsupported ones.
Source
Thrown at cmd/es-index-cleaner/main.go:58
featuregate.WithRegisterFromVersion("v2.5.0"),
featuregate.WithRegisterDescription("Deprecated alias for jaeger.es.index.relativeTimeIndexDeletion."),
featuregate.WithRegisterReferenceURL("https://github.com/jaegertracing/jaeger/issues/9016"),
),
)
}
func main() {
logger, _ := zap.NewProduction()
v := viper.New()
cfg := &app.Config{}
command := &cobra.Command{
Use: "jaeger-es-index-cleaner NUM_OF_DAYS http://HOSTNAME:PORT",
Short: "Jaeger es-index-cleaner removes Jaeger indices",
Long: "Jaeger es-index-cleaner removes Jaeger indices",
RunE: func(_ *cobra.Command, args []string) error {
if len(args) != 2 {
return errors.New("wrong number of arguments")
}
numOfDays, err := strconv.Atoi(args[0])
if err != nil {
return fmt.Errorf("could not parse NUM_OF_DAYS argument: %w", err)
}
if err := cfg.InitFromViper(v); err != nil {
return fmt.Errorf("failed to initialize config: %w", err)
}
ctx := context.Background()
esClient, err := app.NewESClient(ctx, args[1], cfg, logger)
if err != nil {
return fmt.Errorf("error creating Elasticsearch client: %w", err)
}
i := esclient.IndicesClient{
Client: esClient,
MasterTimeoutSeconds: cfg.MasterNodeTimeoutSeconds,View on GitHub (pinned to 806f444784)
Solutions
- Pass a span field reference (e.g. an attribute/tag reference) as the predicate's single argument, not a literal constant.
- Finalize/validate the expression tree so constants are converted to references where the operator requires one.
- Inspect the predicate's arguments before submitting: exactly one reference argument is required.
Example fix
// before
{"op": "tag", "args": ["production"]}
// after
{"op": "tag", "args": {"ref": "tag.production"}} Defensive patterns
Strategy: validation
Validate before calling
func singleRefArg(c *expression.Call) bool {
return len(c.Args) == 1 && isReference(c.Args[0])
} Type guard
func isReference(term expression.Expression) bool {
_, ok := asReference(term)
return ok
} Try / catch
ref, err := refArg(predicate)
if errors.Is(err, tracestore.ErrFilterInvalid) {
// predicate needs a span-field reference argument
} Prevention
- Pass field/tag references, not literals, to ref-reading operators.
- Finalize expression trees so constants become references where required.
- Validate predicate argument shapes client-side before submission.
When it happens
Trigger: Calling a trace search with a filter predicate like tag(...) or a field-reading operator whose argument is a constant or another expression instead of a span field reference, detected in buildFilterQuery via refArg.
Common situations: Writing exists("production") style filters where a constant is passed where a field/tag name reference is expected; programmatically constructed expression trees passing literal values; typos in filter DSL usage.
Related errors
- only one of basic auth (--es.username/--es.password), --es.t
- %w: %w
- file must begin with '['
- only one of basic auth (--es.username/--es.password), --es.t
- empty configuration
AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01).
Data as JSON: /api/errors/c34829478990a7b0.
Report an issue: GitHub.