{"record":{"id":"ec073fdaea65f0c1","repo":"elastic/elasticsearch","slug":"invalid-test-marker-line","errorCode":null,"errorMessage":"Invalid test marker: {line}","messagePattern":"Invalid test marker: (.+?)","errorType":"validation","errorClass":"InvalidUserDataException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/doc/SnippetParser.java","lineNumber":216,"sourceCode":"                        return;\n                    }\n                    if (m.group(6) != null) {\n                        snippetBuilder.withSetup(m.group(6));\n                        return;\n                    }\n                    if (m.group(7) != null) {\n                        snippetBuilder.withTeardown(m.group(7));\n                        return;\n                    }\n                    if (m.group(8) != null) {\n                        snippetBuilder.withWarning(m.group(8));\n                        return;\n                    }\n                    if (m.group(9) != null) {\n                        snippetBuilder.withSkipShardsFailures(true);\n                        return;\n                    }\n                    throw new InvalidUserDataException(\"Invalid test marker: \" + line);\n                });\n            }\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())) {","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/doc/SnippetParser.java#L198-L234","documentation":"Thrown inside the TEST directive parser callback when the matched TEST body contains a token that does not correspond to any of the recognized capture groups (catch:, s/.../.../, skip:, continued, setup:, teardown:, warning:, skip_shards_failures). If the regex matched the overall TEST syntax but none of the numbered alternative groups captured, the callback throws this to signal an unrecognized marker form. This is effectively an 'unreachable unless the TEST_SYNTAX regex and the group checks fall out of sync' guard.","triggerScenarios":"A `// TEST[...]` directive's content matches the outer TEST_SYNTAX pattern (so parsing proceeds) but the specific token inside does not match any of the known alternatives (catch/substitution/skip/continued/setup/teardown/warning/skip_shards_failures). This typically indicates a typo'd marker or a marker the framework does not support.","commonSituations":"A contributor invents a new marker spelling (e.g. `// TEST[setup_up:foo]` instead of `setup:foo`); a copy-paste introduces stray characters; the TEST_SYNTAX regex was edited to accept a broader pattern without a matching handler branch.","solutions":["Check the `// TEST[...]` directive's content against the supported markers: `catch:`, `s/old/new/`, `skip:`, `continued`, `setup:`, `teardown:`, `warning:`, `skip_shards_failures`.","Correct the typo'd marker to one of the supported forms.","If you intended to add a new marker kind, you must extend both the TEST_SYNTAX regex and add a handler branch in testHandled() — this error means you added one without the other."],"exampleFix":"// before: // TEST[setup_up:foo]\n// after:  // TEST[setup:foo]","handlingStrategy":"validation","validationCode":"// Before building, validate each // TEST body token against the allowed set:\n// Set.of(\"catch:\",\"s/\",\"skip:\",\"continued\",\"setup:\",\"teardown:\",\"warning:\",\"skip_shards_failures\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only the documented TEST markers: catch:, s/old/new/, skip:, continued, setup:, teardown:, warning:, skip_shards_failures.","If you extend TEST_SYNTAX, add the matching handler branch in the same change.","Copy TEST directives from a known-good snippet rather than retyping marker names."],"tags":["docs","snippet-tests","validation"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}