jaegertracing/jaeger · error
max spans count reached
Error message
max spans count reached
What it means
forThisEngine translates a regex-ish text pattern into an Elasticsearch wildcard/regexp query. Perl shorthand classes such as \d, \w, \s are rejected with tracestore.ErrFilterUnsupported because the engine reads them as literal characters rather than character classes, so honoring them would silently match the wrong text. The error tells the caller to write the class out explicitly (e.g. [0-9] instead of \d).
Source
Thrown at cmd/anonymizer/app/writer/writer.go:21
package writer
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"os"
"sync"
"github.com/gogo/protobuf/jsonpb"
"go.uber.org/zap"
"github.com/jaegertracing/jaeger-idl/model/v1"
"github.com/jaegertracing/jaeger/cmd/anonymizer/app/anonymizer"
)
var ErrMaxSpansCountReached = errors.New("max spans count reached")
// Config contains parameters to NewWriter.
type Config struct {
MaxSpansCount int `yaml:"max_spans_count" name:"max_spans_count"`
CapturedFile string `yaml:"captured_file" name:"captured_file"`
AnonymizedFile string `yaml:"anonymized_file" name:"anonymized_file"`
MappingFile string `yaml:"mapping_file" name:"mapping_file"`
AnonymizerOpts anonymizer.Options `yaml:"anonymizer" name:"anonymizer"`
}
// Writer is a span Writer that obfuscates the span and writes it to a JSON file.
type Writer struct {
config Config
lock sync.Mutex
logger *zap.Logger
capturedFile *os.File
anonymizedFile *os.File
anonymizer *anonymizer.AnonymizerView on GitHub (pinned to 806f444784)
Solutions
- Replace the shorthand with an explicit character class: [0-9] for \d, [a-zA-Z0-9_] for \w, [ \t] for \s.
- Catch the error with errors.Is(err, tracestore.ErrFilterUnsupported) and rewrite the pattern client-side before retrying.
- Escape the backslash if a literal backslash-character match was actually intended.
Example fix
// before service_name =~ "\d+" // after service_name =~ "[0-9]+"
Defensive patterns
Strategy: validation
Validate before calling
var perlShorthandRe = regexp.MustCompile(`\\[dwsDWS]`)
func patternSafe(p string) bool { return !perlShorthandRe.MatchString(p) } Try / catch
vm, err := forThisEngine(pattern)
if errors.Is(err, tracestore.ErrFilterUnsupported) {
pattern = expandPerlShorthand(pattern) // \d -> [0-9], retry
} Prevention
- Write character classes out: [0-9], [a-zA-Z0-9_], [ \t].
- Lint query patterns for backslash shorthands before submission.
- Remember this engine reads &, @, ~, <n-m>, # as operators; quote or opt out where supported.
When it happens
Trigger: Calling a trace search whose text comparison (attribute or field text match via attributeValueMatch or buildTextComparison) contains a pattern with Perl shorthand escapes like \d, \w, \s in it.
Common situations: Copy-pasting a PCRE/RE2 regex into a Jaeger query; writing attribute 'http.url' =~ "\d+" expecting digit matching; porting filters written for a regex-capable backend to the Elasticsearch backend.
Related errors
- empty configuration
- file must begin with '['
- at least one storage backend is required
- cannot assign unique span ID, too many spans in the trace
- invalid parameters
AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01).
Data as JSON: /api/errors/42343cf8da44544e.
Report an issue: GitHub.