apache/skywalking · error · ApplyException

LAL YAML parse failure for {sourceName}

Error message

LAL YAML parse failure for {sourceName}

What it means

ApplyException wrapping any non-ApplyException Throwable thrown while LalFileApplier.parse deserializes the LAL YAML or stamps per-rule line numbers via DslYamlLineIndex.index(content, "rules"). ApplyException (the empty-rules case) is rethrown untouched; everything else — snakeyaml syntax errors, IO from the StringReader, line-index inconsistencies — is wrapped with this message and an empty partial list.

Source

Thrown at oap-server/server-admin/runtime-rule/src/main/java/org/apache/skywalking/oap/server/receiver/runtimerule/apply/LalFileApplier.java:344

                throw new ApplyException(
                    "LAL YAML parsed to empty/malformed — no rules list in " + sourceName,
                    null, Collections.emptyList());
            }
            // Resolve each rule's line from the SAME text, exactly as the boot loader does.
            // Without this a hot-updated rule compiles to an unlabelled class while its
            // disk-loaded twin is labelled — the two routes must agree.
            final DslYamlLineIndex lineIndex = DslYamlLineIndex.index(yamlContent, "rules");
            for (int i = 0; i < configs.getRules().size(); i++) {
                configs.getRules().get(i).setLineNo(lineIndex.rule(i).getEntryLine());
            }
            // layerDefinitions: are now permitted in runtime LAL rules; the apply path
            // funnels them through the runtime-layer registry. The rejection that used to
            // live here was removed when runtime dynamic layers became a first-class feature.
            return configs;
        } catch (final ApplyException e) {
            throw e;
        } catch (final Throwable t) {
            throw new ApplyException("LAL YAML parse failure for " + sourceName, t,
                Collections.emptyList());
        }
    }

    /** Result of a successful {@link #apply} — retained so the next update/delete can unwind. */
    public static final class Applied implements EngineApplied {
        @Getter
        private final String sourceName;
        @Getter
        private final List<RegisteredRule> registered;
        /**
         * Per-file loader that owns every generated {@code LalExpression} class for this apply.
         * Retained as a strong reference so the classes stay live while the bundle is ACTIVE;
         * the dslManager retires it through {@code ClassLoaderGc} on unregister so GC is
         * observable. Null for the legacy 2-arg {@link #apply(String, String)} entry point,
         * which remains for backward compatibility in tests.
         */
        @Getter

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Fix the syntax error named by the cause (snakeyaml marks carry line/column)
  2. Avoid YAML anchors/aliases and flow-style lists under 'rules:' — emit plain block-style entries the line indexer can anchor
  3. Validate parse + line-index locally with DslYamlLineIndex.index(content, "rules") before submit
  4. Split large files: smaller documents localize syntax errors and reduce rollback blast radius
Defensive patterns

Strategy: validation

Validate before calling

try (StringReader r = new StringReader(content)) {
    final LALConfigs c = new Yaml().loadAs(r, LALConfigs.class); // throws on syntax error
    final DslYamlLineIndex ix = DslYamlLineIndex.index(content, "rules"); // throws on un-indexable structure
    for (int i = 0; i < c.getRules().size(); i++) ix.rule(i); // must resolve every entry
}

Try / catch

catch (ApplyException e) with 'LAL YAML parse failure for': surface cause mark; treat as content defect (fail, don't retry).

Prevention

When it happens

Trigger: Applying runtime LAL content with a genuine YAML syntax error (tabs, bad indent, unterminated quote), or content whose 'rules' node cannot be line-indexed (e.g. rules expressed as a flow list or an anchor/alias the indexer can't map to an entry line).

Common situations: Hot-updating a hand-edited file where indentation drifted; CI templating that emits YAML anchors (&rules/*rules) which the line indexer cannot resolve to real entry lines; Multidocument YAML (--- separators) where the first document is empty

Related errors


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