pinpoint-apm/pinpoint · error · UnsupportedOperationException

BracketMatcherOperator is not an operation target.

Error message

BracketMatcherOperator is not an operation target.

What it means

BracketMatcherOperator represents the '(' parenthesis token in the matcher operand expression tree. It is purely a structural marker used by the operand parser, not a real operand, so its and()/or()/not() composition methods intentionally throw UnsupportedOperationException to signal that you cannot combine it as an operand.

Source

Thrown at agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/instrument/matcher/operator/BracketMatcherOperator.java:60

    @Override
    public boolean isIndex() {
        return false;
    }

    @Override
    public MatcherOperand getLeftOperand() {
        return null;
    }

    @Override
    public MatcherOperand getRightOperand() {
        return null;
    }

    @Override
    public MatcherOperand and(MatcherOperand operand) {
        throw new UnsupportedOperationException("BracketMatcherOperator is not an operation target.");
    }

    @Override
    public MatcherOperand or(MatcherOperand operand) {
        throw new UnsupportedOperationException("BracketMatcherOperator is not an operation target.");
    }

    @Override
    public MatcherOperand not() {
        throw new UnsupportedOperationException("BracketMatcherOperator is not an operation target.");
    }

    public String toString() {
        return "(";
    }
}

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Do not call and/or/not on BracketMatcherOperator; call them on the MatcherOperand that the bracket encloses or wraps
  2. Use Matchers.Operators.andChain()/orChain() correctly: brackets only delimit grouping, the methods belong to operand classes
  3. Review the operand tree construction so and/or are invoked on leaf operands (ClassInternalNameMatcher etc.)

Example fix

// before
MatcherOperand op = Operators.andChain();
op.and(new ClassInternalNameMatcher("Foo")); // throws
// after
MatcherOperand op = new ClassInternalNameMatcher("Foo").and(new ArgsMatcher(2));
Defensive patterns

Strategy: validation

Validate before calling

if (operand instanceof BracketMatcherOperator) {
    throw new IllegalArgumentException("bracket token is not combinable; use a real MatcherOperand");
}

Type guard

boolean isRealOperand(MatcherOperand o) { return o != null && !(o instanceof BracketMatcherOperator); }

Prevention

When it happens

Trigger: Calling and(), or(), or not() directly on a BracketMatcherOperator instance obtained from Matchers.Operators (e.g. via andChain()/orChain() parentheses tokens) instead of on a real MatcherOperand.

Common situations: Building a custom matcher expression by hand and misusing the bracket token from an operator chain; calling composition methods on the wrong object returned by an operand builder API.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/e3ba8458b8051702. Report an issue: GitHub.