apache/skywalking · error · IllegalArgumentException

Unknown MAL extension function: {}::{}

Error message

Unknown MAL extension function: {}::{}

What it means

Thrown by MALMethodChainCodegen when an expression uses the extension-call syntax namespace::method() but MalExtensionRegistry.lookup(namespace, method) returns null — i.e. no SPI-registered MalFunctionExtension provides that method under that namespace. The v2 compiler resolves extension calls at compile time and emits direct static calls, so an unresolvable name fails the whole rule compilation with IllegalArgumentException.

Source

Thrown at oap-server/analyzer/meter-analyzer/src/main/java/org/apache/skywalking/oap/meter/analyzer/v2/compiler/MALMethodChainCodegen.java:151

    }

    // ==================== Extension function codegen ====================

    /**
     * Emits a direct static method call for an extension function.
     *
     * <p>For {@code .test::scale(3.0)} on variable {@code _metric}, generates:
     * {@code _metric = TestMalExtension.scale(_metric, 3.0);}
     */
    private void emitExtensionCall(final StringBuilder sb,
                                    final String var,
                                    final MALExpressionModel.MethodCall mc) {
        final String ns = mc.getNamespace();
        final String method = mc.getName();
        final MalExtensionRegistry.ExtensionMethod em =
            MalExtensionRegistry.lookup(ns, method);
        if (em == null) {
            throw new IllegalArgumentException(
                "Unknown MAL extension function: " + ns + "::" + method);
        }
        final List<MALExpressionModel.Argument> args = mc.getArguments();
        final int expectedArgs = em.getExtraParamTypes().length;
        if (args.size() != expectedArgs) {
            throw new IllegalArgumentException(
                "MAL extension " + ns + "::" + method + " expects "
                    + expectedArgs + " argument(s), got " + args.size());
        }
        sb.append("  ").append(var).append(" = ")
          .append(em.getDeclaringClass()).append('.')
          .append(em.getMethodName()).append('(')
          .append(var);
        for (int i = 0; i < args.size(); i++) {
            sb.append(", ");
            generateExtensionArg(sb, args.get(i), em.getExtraParamTypes()[i]);
        }
        sb.append(");\n");

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Verify the namespace and method name in the expression exactly match ext.name() and the @MALContextFunction-annotated static method of your extension class
  2. Confirm the extension jar is on the OAP classpath and contains META-INF/services/org.apache.skywalking.oap.meter.analyzer.v2.spi.MalFunctionExtension listing the implementation class
  3. Check the startup log for 'Registered MAL extension function {ns}::{method}()' lines — if the namespace is absent, SPI discovery failed
  4. Remove the extension call from the rule if the extension was never intended to ship

Example fix

# before (rule YAML)
expr: node_cpu.sum(['mode']).genai::estimateCost()
# extension class declares name() = "genAi" (case mismatch)

# after — align names
public String name() { return "genai"; }
# or fix the rule
expr: node_cpu.sum(['mode']).genAi::estimateCost()
Defensive patterns

Strategy: validation

Validate before calling

MalExtensionRegistry.ExtensionMethod em = MalExtensionRegistry.lookup(ns, method);
if (em == null) {
    throw new IllegalArgumentException(
        "Extension " + ns + "::" + method + " not registered; available: "
        + MalExtensionRegistry.namespaces());
}

Try / catch

catch IllegalArgumentException around DSL.parse; surface ns::method in the error and check the startup log for 'Registered MAL extension function' lines

Prevention

When it happens

Trigger: Expression like 'metric.sum([\'svc\']).myext::scale(3.0)' where (a) no MalFunctionExtension implementation named 'myext' is on the ServiceLoader path, (b) the method exists but under a different namespace, (c) the namespace is registered but the method name is misspelled, or (d) the SPI file META-INF/services/org.apache.skywalking.oap.meter.analyzer.v2.spi.MalFunctionExtension is missing the implementing class.

Common situations: Typoing the namespace or method name in the YAML rule; deploying a custom extension jar that is not on the OAP classpath (not copied into oap-libs or the ext directory); upgrading OAP where the extension class/package was renamed; forgetting the SPI registration file in a newly built extension jar.

Related errors


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