apache/skywalking · error · IllegalArgumentException

LAL script parsing failed: {errors} in script: {dsl}

Error message

LAL script parsing failed: {errors} in script: {dsl}

What it means

Thrown by ProcessDetectType.valueOf(int) when the integer has no mapping in the enum dictionary (currently DEFINITE=0 and LANGUAGE_AGENT=1). ProcessDetectType distinguishes how a process was discovered (definite detection vs. language-agent report); the int is persisted and transmitted, so an out-of-range value means unknown or corrupt data.

Source

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

        final LALParser parser = new LALParser(tokens);

        final List<String> errors = new ArrayList<>();
        parser.removeErrorListeners();
        parser.addErrorListener(new BaseErrorListener() {
            @Override
            public void syntaxError(final Recognizer<?, ?> recognizer,
                                    final Object offendingSymbol,
                                    final int line,
                                    final int charPositionInLine,
                                    final String msg,
                                    final RecognitionException e) {
                errors.add(line + ":" + charPositionInLine + " " + msg);
            }
        });

        final LALParser.RootContext tree = parser.root();
        if (!errors.isEmpty()) {
            throw new IllegalArgumentException(
                "LAL script parsing failed: " + String.join("; ", errors)
                    + " in script: " + truncate(dsl, 200));
        }

        final List<FilterStatement> stmts = visitFilterContent(
            tree.filterBlock().filterContent());
        return new LALScriptModel(stmts);
    }

    // ==================== Filter content ====================

    private static List<FilterStatement> visitFilterContent(
            final LALParser.FilterContentContext ctx) {
        final List<FilterStatement> stmts = new ArrayList<>();
        for (final LALParser.FilterStatementContext fsc : ctx.filterStatement()) {
            stmts.add(visitFilterStatement(fsc));
        }
        return stmts;

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Validate the int against known values (0/1) before calling valueOf, and default or reject on unknown
  2. Align agent and OAP versions so the protocol enum sets match
  3. For corrupt storage rows, re-ingest or patch the process data

Example fix

// before
ProcessDetectType t = ProcessDetectType.valueOf(rawInt); // throws on 2+
// after
ProcessDetectType t = rawInt == ProcessDetectType.DEFINITE.value()
    ? ProcessDetectType.DEFINITE : ProcessDetectType.LANGUAGE_AGENT;
Defensive patterns

Strategy: validation

Validate before calling

boolean known = rawInt == ProcessDetectType.DEFINITE.value() || rawInt == ProcessDetectType.LANGUAGE_AGENT.value();

Try / catch

try { type = ProcessDetectType.valueOf(v); } catch (UnexpectedException e) { type = ProcessDetectType.DEFINITE; log.warn("unknown ProcessDetectType {}", v); }

Prevention

When it happens

Trigger: Deserializing a Process record or protocol payload whose detect type field is 2+, or decoding storage data written by an incompatible version; also direct calls like ProcessDetectType.valueOf(99).

Common situations: Version skew between agent protocol and OAP (a newer agent sends a new detect type the older OAP doesn't know); corrupted storage rows; test fixtures using made-up ints.

Related errors


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