alibaba/arthas · error · IllegalArgumentException

Method-pattern is expected, please type the wildcard express

Error message

Method-pattern is expected, please type the wildcard expression to match

What it means

Thrown by checkArguments() in the `tt` command when record mode (-t) is active with a class-pattern present but the method-pattern is empty. Recording requires both a class and a method wildcard.

Source

Thrown at core/src/main/java/com/taobao/arthas/core/command/monitor200/TimeTunnelCommand.java:264

     */
    private void checkArguments() {
        String validateError = validateSizeLimit(sizeLimit);
        if (validateError != null) {
            throw new IllegalArgumentException(validateError);
        }

        // 检查d/p参数是否有i参数配套
        if ((isDelete || isPlay) && null == index) {
            throw new IllegalArgumentException("Time fragment index is expected, please type -i to specify");
        }

        // 在t参数下class-pattern,method-pattern
        if (isTimeTunnel) {
            if (StringUtils.isEmpty(classPattern)) {
                throw new IllegalArgumentException("Class-pattern is expected, please type the wildcard expression to match");
            }
            if (StringUtils.isEmpty(methodPattern)) {
                throw new IllegalArgumentException("Method-pattern is expected, please type the wildcard expression to match");
            }
        }

        // 一个参数都没有是不行滴
        if (null == index && !isTimeTunnel && !isDeleteAll && StringUtils.isEmpty(watchExpress)
                && !isList && StringUtils.isEmpty(searchExpress)) {
            throw new IllegalArgumentException("Argument(s) is/are expected, type 'help tt' to read usage");
        }
    }

    /*
     * 记录时间片段
     */
    int putTimeTunnel(TimeFragment tt) {
        int indexOfSeq = sequence.getAndIncrement();
        timeFragmentMap.put(indexOfSeq, tt);
        return indexOfSeq;
    }

View on GitHub (pinned to 21cf2e9ba5)

Solutions

  1. Add `--method-pattern <wildcard>`, e.g. `--method-pattern primeFactors` or `--method-pattern *` to match all methods.
  2. Confirm both class and method patterns are non-empty when using -t.

Example fix

// before
tt -t --class-pattern demo.MathGame
// after
tt -t --class-pattern demo.MathGame --method-pattern *
Defensive patterns

Strategy: validation

Validate before calling

if (isTimeTunnel && (methodPattern == null || methodPattern.trim().isEmpty())) {
    fail("-t requires --method-pattern");
}

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Running `tt -t --class-pattern demo.MathGame` with no `--method-pattern`, or `tt -t --class-pattern demo.MathGame --method-pattern ""`.

Common situations: Forgetting the method-pattern; intending to match all methods (use `--method-pattern *` rather than empty).

Related errors


AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14). Data as JSON: /api/errors/96fb59e8325b417f. Report an issue: GitHub.