apache/skywalking · critical · ModuleStartException
Failed to compile LAL expression: {dsl}
Error message
Failed to compile LAL expression: {dsl} What it means
Top-level wrapper: DSL.of(...) compiles the LAL DSL (ANTLR parse → AST → Javassist class generation → class load) and wraps ANY exception thrown in that pipeline in a ModuleStartException whose message embeds the full DSL text. The root cause (parse error, codegen IllegalArgumentException, Javassist compile failure, Class.forName miss) is always in the cause chain. Because it is a ModuleStartException, an unhandled occurrence aborts OAP startup or a runtime-rule update.
Source
Thrown at oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/v2/dsl/DSL.java:144
// (otherwise debugHolder() returns null on the compiled expression).
final GateHolder holder = expression.debugHolder();
if (holder != null) {
final LinkedHashMap<String, String> meta = new LinkedHashMap<>();
if (ruleName != null && !ruleName.isEmpty()) {
meta.put("ruleName", ruleName);
}
if (outputType != null) {
meta.put("outputClass", outputType.getName());
}
if (inputType != null) {
meta.put("inputClass", inputType.getName());
}
holder.setMetadata(meta);
}
final FilterSpec filterSpec = new FilterSpec(moduleManager, config);
return new DSL(ruleName, expression, filterSpec, effectiveInputType);
} catch (Exception e) {
throw new ModuleStartException(
"Failed to compile LAL expression: " + dsl, e);
}
}
public void evaluate(final ExecutionContext ctx) {
if (log.isDebugEnabled()) {
final LogMetadata metadata = ctx.metadata();
log.debug("[LAL] rule={}, class={}, service={}, instance={}, endpoint={}",
ruleName, expression.getClass().getName(),
metadata.getService(), metadata.getServiceInstance(),
metadata.getEndpoint());
}
expression.execute(filterSpec, ctx);
}
}
View on GitHub (pinned to 102af09b4a)
Solutions
- Read the nested cause in the stack trace (getCause()) — the wrapper message only echoes the DSL, the cause names the actual problem and codegen line
- Fix the underlying rule error per the cause message (unknown field, arity, cast, getter, etc.)
- Validate the rule against the shipped lal/*.yaml examples and the grammar before deploying
- If the cause is CannotCompileException with no obvious rule error, check for generated-Java issues and report with SW_DYNAMIC_CLASS_ENGINE_DEBUG=true dumps
Defensive patterns
Strategy: try-catch
Try / catch
try {
DSL dsl = DSL.of(moduleManager, config, dslText, inputType, outputType, ruleName, sourceRef, null, null);
} catch (ModuleStartException e) {
// The DSL text is in e.getMessage(); the REAL reason is in the cause chain.
Throwable root = e;
while (root.getCause() != null && root.getCause() != root) root = root.getCause();
log.error("LAL rule {} rejected: {} at {}", ruleName, root.getMessage(), root.getStackTrace()[0]);
// keep the previously active rule bundle; surface the error to the operator
} Prevention
- Always inspect the deepest cause, not the wrapper message
- Compile candidate rules in a staging environment before enabling them at runtime
- Use SW_DYNAMIC_CLASS_ENGINE_DEBUG=true to dump generated Java when causes are unclear
When it happens
Trigger: Any DSL.of call — startup loadStaticRules or the runtime-rule path — where the rule text fails parsing or codegen: unknown fields, bad tag() usage on typed input, missing getters on inputType, invalid casts, syntax errors; also Javassist CannotCompileException when generated Java is invalid (a compiler bug indicator).
Common situations: Deploying a hand-written LAL YAML with a syntax or semantic error; a runtime rule update pushed via the dynamic-config channel; upgrading SkyWalking where grammar keywords changed (e.g. slowSql/sampledTrace removal).
Related errors
- Failed to create LAL listener factory.
- Failed to load static LAL rules.
- tag() reads LogData tags but the input type is {inputTypeNam
- sourceAttribute() requires exactly one string literal argume
- Cannot resolve {desc} — no matching codegen path. Parser typ
AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14).
Data as JSON: /api/errors/c4e7ffb66e8eb3f9.
Report an issue: GitHub.