{"record":{"id":"b22a4f25d35e2253","repo":"apache/skywalking","slug":"lal-yaml-parse-failure-for-sourcename","errorCode":null,"errorMessage":"LAL YAML parse failure for {sourceName}","messagePattern":"LAL YAML parse failure for (.+?)","errorType":"http","errorClass":"ApplyException","httpStatus":500,"severity":"error","filePath":"oap-server/server-admin/runtime-rule/src/main/java/org/apache/skywalking/oap/server/receiver/runtimerule/apply/LalFileApplier.java","lineNumber":344,"sourceCode":"                throw new ApplyException(\n                    \"LAL YAML parsed to empty/malformed — no rules list in \" + sourceName,\n                    null, Collections.emptyList());\n            }\n            // Resolve each rule's line from the SAME text, exactly as the boot loader does.\n            // Without this a hot-updated rule compiles to an unlabelled class while its\n            // disk-loaded twin is labelled — the two routes must agree.\n            final DslYamlLineIndex lineIndex = DslYamlLineIndex.index(yamlContent, \"rules\");\n            for (int i = 0; i < configs.getRules().size(); i++) {\n                configs.getRules().get(i).setLineNo(lineIndex.rule(i).getEntryLine());\n            }\n            // layerDefinitions: are now permitted in runtime LAL rules; the apply path\n            // funnels them through the runtime-layer registry. The rejection that used to\n            // live here was removed when runtime dynamic layers became a first-class feature.\n            return configs;\n        } catch (final ApplyException e) {\n            throw e;\n        } catch (final Throwable t) {\n            throw new ApplyException(\"LAL YAML parse failure for \" + sourceName, t,\n                Collections.emptyList());\n        }\n    }\n\n    /** Result of a successful {@link #apply} — retained so the next update/delete can unwind. */\n    public static final class Applied implements EngineApplied {\n        @Getter\n        private final String sourceName;\n        @Getter\n        private final List<RegisteredRule> registered;\n        /**\n         * Per-file loader that owns every generated {@code LalExpression} class for this apply.\n         * Retained as a strong reference so the classes stay live while the bundle is ACTIVE;\n         * the dslManager retires it through {@code ClassLoaderGc} on unregister so GC is\n         * observable. Null for the legacy 2-arg {@link #apply(String, String)} entry point,\n         * which remains for backward compatibility in tests.\n         */\n        @Getter","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/server-admin/runtime-rule/src/main/java/org/apache/skywalking/oap/server/receiver/runtimerule/apply/LalFileApplier.java#L326-L362","documentation":"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.","triggerScenarios":"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).","commonSituations":"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","solutions":["Fix the syntax error named by the cause (snakeyaml marks carry line/column)","Avoid YAML anchors/aliases and flow-style lists under 'rules:' — emit plain block-style entries the line indexer can anchor","Validate parse + line-index locally with DslYamlLineIndex.index(content, \"rules\") before submit","Split large files: smaller documents localize syntax errors and reduce rollback blast radius"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"try (StringReader r = new StringReader(content)) {\n    final LALConfigs c = new Yaml().loadAs(r, LALConfigs.class); // throws on syntax error\n    final DslYamlLineIndex ix = DslYamlLineIndex.index(content, \"rules\"); // throws on un-indexable structure\n    for (int i = 0; i < c.getRules().size(); i++) ix.rule(i); // must resolve every entry\n}","typeGuard":null,"tryCatchPattern":"catch (ApplyException e) with 'LAL YAML parse failure for': surface cause mark; treat as content defect (fail, don't retry).","preventionTips":["Emit plain block-style YAML only — no anchors, aliases, or flow lists under rules:","Lint rendered YAML in CI with the real parser and line indexer","Keep files small to localize syntax errors"],"tags":["yaml","lal","parse","runtime-rule"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}