apache/skywalking · error · IllegalArgumentException

Cannot resolve method {simpleName}.{methodName}() in def var

Error message

Cannot resolve method {simpleName}.{methodName}() in def variable chain

What it means

Thrown by TimeBucket.retainToDay4MinuteBucket(long) when the argument fails isMinuteBucket — i.e. it is not a 12-digit yyyyMMddHHmm value. The method truncates HHmm to 0000 to get the day-start bucket; feeding it a second/hour/day bucket or an epoch timestamp is a contract violation.

Source

Thrown at oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/v2/compiler/LALDefCodegen.java:267

        String prevExpr = localVar.javaVarName;
        Class<?> currentType = localVar.resolvedType;
        boolean canBeNull = true;

        for (int i = 0; i < chain.size(); i++) {
            final LALScriptModel.ValueAccessSegment seg = chain.get(i);
            final boolean isLast = i == chain.size() - 1;

            if (seg instanceof LALScriptModel.MethodSegment) {
                final LALScriptModel.MethodSegment ms =
                    (LALScriptModel.MethodSegment) seg;
                final String methodName = ms.getName();

                // Resolve method on currentType via reflection
                final Method method =
                    resolveMethod(currentType, methodName, ms.getArguments());
                if (method == null) {
                    throw new IllegalArgumentException(
                        "Cannot resolve method " + currentType.getSimpleName()
                            + "." + methodName + "() in def variable chain");
                }
                final Class<?> returnType = method.getReturnType();
                final String args =
                    LALValueCodegen.generateMethodArgs(ms.getArguments(), genCtx);

                if (ms.isSafeNav() && canBeNull) {
                    if (isLast && returnType.isPrimitive()) {
                        // Primitive return with null guard
                        final String boxName =
                            LALCodegenHelper.boxTypeName(returnType);
                        prevExpr = "(" + prevExpr + " == null ? null : "
                            + boxName + ".valueOf(" + prevExpr + "."
                            + methodName + "(" + args + ")))";
                        currentType = returnType;
                    } else {
                        prevExpr = "(" + prevExpr + " == null ? null : "

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Guard the call with TimeBucket.isMinuteBucket(bucket) and fix the producer if it isn't minute precision
  2. Convert first: from a day bucket use the value directly; from an epoch use TimeBucket.getTimeBucket(ts, DownSampling.Minute)
  3. Add a unit test asserting the 12-digit shape of buckets entering the rollup path

Example fix

// before
long dayBucket = TimeBucket.retainToDay4MinuteBucket(hourBucket); // throws
// after
long dayBucket;
if (TimeBucket.isMinuteBucket(hourBucket)) {
    dayBucket = TimeBucket.retainToDay4MinuteBucket(hourBucket);
} else {
    dayBucket = TimeBucket.retainToDay4MinuteBucket(
        TimeBucket.getTimeBucket(TimeBucket.getTimestamp(hourBucket), DownSampling.Minute));
}
Defensive patterns

Strategy: validation

Validate before calling

if (TimeBucket.isMinuteBucket(minuteTimeBucket)) { long day = TimeBucket.retainToDay4MinuteBucket(minuteTimeBucket); }

Prevention

When it happens

Trigger: Calling retainToDay4MinuteBucket with a day bucket (yyyyMMdd), a second bucket (yyyyMMddHHmmss), or an epoch-millis value. Typical when a metric pipeline passes the wrong precision tier into a day-retention step.

Common situations: Mixing precision tiers across TTL/rollup jobs; refactoring code that used to carry minute buckets into paths that now carry hour buckets; unit tests seeded with fake bucket values that don't respect the digit shape.

Related errors


AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14). Data as JSON: /api/errors/12b182db19940d0b. Report an issue: GitHub.