{"record":{"id":"1a0da96b1d5a1cab","repo":"elastic/elasticsearch","slug":"notconsole-not-paired-with-a-snippet","errorCode":null,"errorMessage":"NOTCONSOLE not paired with a snippet","messagePattern":"NOTCONSOLE not paired with a snippet","errorType":"validation","errorClass":"InvalidUserDataException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/doc/SnippetParser.java","lineNumber":236,"sourceCode":"            }\n            return true;\n        }\n        return false;\n    }\n\n    protected boolean consoleHandled(String line, SnippetBuilder snippet) {\n        if (line.matches(getConsoleRegex())) {\n            if (snippetBuilder == null) {\n                throw new InvalidUserDataException(\"CONSOLE not paired with a snippet\");\n            }\n            if (snippetBuilder.consoleDefined()) {\n                throw new InvalidUserDataException(\"Can't be both CONSOLE and NOTCONSOLE\");\n            }\n            snippetBuilder.withConsole(Boolean.TRUE);\n            return true;\n        } else if (line.matches(getNotconsoleRegex())) {\n            if (snippet == null) {\n                throw new InvalidUserDataException(\"NOTCONSOLE not paired with a snippet\");\n            }\n            if (snippetBuilder.consoleDefined()) {\n                throw new InvalidUserDataException(\"Can't be both CONSOLE and NOTCONSOLE\");\n            }\n            snippet.withConsole(Boolean.FALSE);\n            return true;\n        }\n        return false;\n    }\n\n    protected abstract String getTestSetupRegex();\n\n    protected abstract String getTeardownRegex();\n\n    protected abstract String getConsoleRegex();\n\n    protected abstract String getNotconsoleRegex();\n","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/doc/SnippetParser.java#L218-L254","documentation":"Thrown by SnippetParser.consoleHandled() in the NOTCONSOLE branch when a line matching the NOTCONSOLE regex is found but the `snippet` parameter (the snippet passed into consoleHandled) is null. This is the NOTCONSOLE analog of error 212: a NOTCONSOLE directive with no open snippet to attach to. Note the null check here uses the method's `snippet` argument, while the CONSOLE branch uses the `snippetBuilder` field — both refer to the active snippet.","triggerScenarios":"A `// NOTCONSOLE` line appears with no currently-open snippet. The getNotconsoleRegex matches and the passed snippet is null.","commonSituations":"An orphaned `// NOTCONSOLE` left after its source block was deleted; the directive placed before any snippet opens; a copy-paste artifact.","solutions":["Position the `// NOTCONSOLE` directive so it attaches to an open snippet, or remove it if its snippet is gone.","Confirm the snippet-opening syntax is recognized by the parser so a snippet is actually open when NOTCONSOLE is reached."],"exampleFix":"// before:\n// NOTCONSOLE\n// (no source block)\n// after:\n----\necho hello\n----\n// NOTCONSOLE","handlingStrategy":"validation","validationCode":"// Before building, walk doc lines and ensure every // NOTCONSOLE has an open snippet to attach to.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair `// NOTCONSOLE` with an open snippet.","Remove orphaned `// NOTCONSOLE` when its snippet is deleted.","Confirm the snippet-opening syntax is recognized by the parser."],"tags":["docs","snippet-tests","validation"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}