elastic/elasticsearch · error · IllegalArgumentException

Invalid tag format [{l}]

Error message

Invalid tag format [{l}]

What it means

Thrown by AbstractVersionsTask.splitVersionIds when a line in the version-list input does not split on ':' into exactly two parts. Each line is expected to be '<id>:<value>'; any line with zero, one, or three+ colon-separated fields is malformed and the task cannot build its version-id map.

Source

Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/AbstractVersionsTask.java:136

    static final String SERVER_MODULE_PATH = "server/src/main/java/";

    static final String VERSION_FILE_PATH = SERVER_MODULE_PATH + "org/elasticsearch/Version.java";
    static final String INDEX_VERSIONS_FILE_PATH = SERVER_MODULE_PATH + "org/elasticsearch/index/IndexVersions.java";

    static final String SERVER_RESOURCES_PATH = "server/src/main/resources/";
    static final String INDEX_VERSIONS_RECORD = SERVER_RESOURCES_PATH + "org/elasticsearch/index/IndexVersions.csv";

    final Path rootDir;

    protected AbstractVersionsTask(BuildLayout layout) {
        rootDir = layout.getRootDirectory().toPath();
    }

    static Map<String, Integer> splitVersionIds(List<String> version) {
        return version.stream().map(l -> {
            var split = l.split(":");
            if (split.length != 2) throw new IllegalArgumentException("Invalid tag format [" + l + "]");
            return split;
        }).collect(Collectors.toMap(l -> l[0], l -> Integer.parseInt(l[1])));
    }

    static OptionalInt findSingleIntegerExpr(FieldDeclaration field) {
        var ints = field.findAll(IntegerLiteralExpr.class);
        switch (ints.size()) {
            case 0 -> {
                return OptionalInt.empty();
            }
            case 1 -> {
                return OptionalInt.of(ints.get(0).asNumber().intValue());
            }
            default -> {
                LOGGER.warn("Multiple integers found in version field declaration [{}]", field); // and ignore it
                return OptionalInt.empty();
            }
        }

View on GitHub (pinned to db6a809a66)

Solutions

  1. Inspect the offending line named by [l] in the message and correct it to the '<id>:<value>' form.
  2. Regenerate the input file via the producing task (e.g. re-run ExtractCurrentVersionsTask) rather than editing by hand.
  3. Filter out blank/whitespace lines before calling splitVersionIds if the producer may emit them.
  4. Re-run the consuming release task.

Example fix

// before (malformed line)
IndexVersion:42
BadLineWithoutColon
// after
IndexVersion:42
OtherId:43
Defensive patterns

Strategy: validation

Validate before calling

for (String l : versionLines) {
    String[] split = l.split(":");
    if (split.length != 2) throw new IllegalArgumentException("Bad version line: " + l);
}

Prevention

When it happens

Trigger: splitVersionIds maps over a List<String> of version entries, splitting each on ':'; if split.length != 2 the entry is rejected. This input is read from tag/version metadata produced elsewhere (e.g. the --output-file of ExtractCurrentVersionsTask), so a malformed line indicates a corrupted or hand-edited input file or a change in the producer's format.

Common situations: Hand-editing the version-list file; a producer task changed its output format but the consumer wasn't updated; trailing blank lines or stray characters; copy-paste introduced a line without the ':' separator; an empty line fed into the list.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/0fd4d358645c31be. Report an issue: GitHub.