apache/skywalking · error · IllegalArgumentException

Unsupported extension parameter type: {}

Error message

Unsupported extension parameter type: {}

What it means

Thrown by MALMethodChainCodegen.generateExtensionArg when the extension method's Java parameter type is none of String, double/float/long/int (or boxed variants), or List<String>. The codegen can only emit literals for that fixed type set, so any other parameter type (boolean, Object, custom class, Map, char, short...) on a @MALContextFunction method makes the rule uncompilable at the point the argument is generated.

Source

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

                final List<String> values =
                    ((MALExpressionModel.StringListArgument) arg).getValues();
                sb.append("java.util.Arrays.asList(new String[]{");
                for (int i = 0; i < values.size(); i++) {
                    if (i > 0) {
                        sb.append(", ");
                    }
                    sb.append('"')
                      .append(DslJavaSourceText.toLiteral(values.get(i)))
                      .append('"');
                }
                sb.append("})");
            } else {
                throw new IllegalArgumentException(
                    "Expected list argument for extension function, got "
                        + arg.getClass().getSimpleName());
            }
        } else {
            throw new IllegalArgumentException(
                "Unsupported extension parameter type: "
                    + expectedType.getName());
        }
    }

    // ==================== Argument codegen ====================

    /**
     * Generates a method call argument with special handling for primitive double methods.
     * For {@code .valueEqual(33)}: emits raw {@code 33.0}.
     * For {@code .multiply(100)}: emits boxed {@code Long.valueOf(100L)}.
     */
    private void generateMethodCallArg(final StringBuilder sb,
                                        final String var,
                                        final MALExpressionModel.Argument arg,
                                        final boolean primitiveDouble) {
        if (primitiveDouble
                && arg instanceof MALExpressionModel.ExprArgument) {

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Change the parameter type to one of the supported ones: String, double/Double, float/Float, long/Long, int/Integer, or List<String> (e.g. pass "true"/"false" as String and parse it)
  2. Move richer configuration into the extension implementation itself (constructor, static config) instead of MAL arguments
  3. Rebuild the extension jar and restart OAP so the corrected signature is registered

Example fix

// before
@MALContextFunction
public static SampleFamily f(SampleFamily sf, boolean enabled) { ... }

// after
@MALContextFunction
public static SampleFamily f(SampleFamily sf, String enabled) {
    boolean on = Boolean.parseBoolean(enabled);
    ...
}
// rule: .myext::f("true")
Defensive patterns

Strategy: validation

Validate before calling

private static final Set<Class<?>> SUPPORTED = Set.of(String.class, double.class,
    Double.class, float.class, Float.class, long.class, Long.class, int.class, Integer.class);

void checkSignature(Method m) {
    for (Class<?> p : m.getParameterTypes()) {
        if (p != SampleFamily.class && !SUPPORTED.contains(p) && p != List.class) {
            throw new IllegalArgumentException("Unsupported param type " + p + " on " + m);
        }
    }
}

Try / catch

this is raised at codegen; catch at DSL.parse level and report the extension class/method to its maintainer

Prevention

When it happens

Trigger: A @MALContextFunction method like 'f(SampleFamily, boolean flag)' or 'f(SampleFamily, Map<String,String> ctx)' invoked from a MAL expression — generateExtensionArg hits the final else branch for the unsupported type.

Common situations: Writing a new custom extension with a convenient boolean or enum flag parameter without knowing MAL's restricted parameter type table; reusing an existing Java utility method by just adding the annotation.

Related errors


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