elastic/elasticsearch · error · InvalidUserDataException
Invalid test marker: {line}
Error message
Invalid test marker: {line} What it means
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.
Source
Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/doc/SnippetParser.java:216
return;
}
if (m.group(6) != null) {
snippetBuilder.withSetup(m.group(6));
return;
}
if (m.group(7) != null) {
snippetBuilder.withTeardown(m.group(7));
return;
}
if (m.group(8) != null) {
snippetBuilder.withWarning(m.group(8));
return;
}
if (m.group(9) != null) {
snippetBuilder.withSkipShardsFailures(true);
return;
}
throw new InvalidUserDataException("Invalid test marker: " + line);
});
}
return true;
}
return false;
}
protected boolean consoleHandled(String line, SnippetBuilder snippet) {
if (line.matches(getConsoleRegex())) {
if (snippetBuilder == null) {
throw new InvalidUserDataException("CONSOLE not paired with a snippet");
}
if (snippetBuilder.consoleDefined()) {
throw new InvalidUserDataException("Can't be both CONSOLE and NOTCONSOLE");
}
snippetBuilder.withConsole(Boolean.TRUE);
return true;
} else if (line.matches(getNotconsoleRegex())) {View on GitHub (pinned to db6a809a66)
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.
Example fix
// before: // TEST[setup_up:foo] // after: // TEST[setup:foo]
Defensive patterns
Strategy: validation
Validate before calling
// Before building, validate each // TEST body token against the allowed set:
// Set.of("catch:","s/","skip:","continued","setup:","teardown:","warning:","skip_shards_failures") Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unexpected unconverted snippets: {foundButNotListed}
- Couldn't find the corresponding mdx file for {asciidocFileAb
- Yaml rest specs ({asciidocFile} and {mdxFile}) are not equal
- Yaml rest specs ({asciidocFile} and {mdxFile}) are not equal
- {name}: Snippet missing a language. This is required by Elas
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/ec073fdaea65f0c1.
Report an issue: GitHub.