{"record":{"id":"5d80bca378f0a06a","repo":"elastic/elasticsearch","slug":"incorrect-format-for-line-s","errorCode":null,"errorMessage":"Incorrect format for line [%s]","messagePattern":"Incorrect format for line \\[(.+?)\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/TagVersionsTask.java","lineNumber":105,"sourceCode":"        }\n    }\n\n    /*\n     * V7 just extracts a single Version. If so, this version needs to be applied to transport and index versions.\n     */\n    private static Map<String, Integer> expandV7Version(Map<String, Integer> tagVersions) {\n        Integer v7Version = tagVersions.get(\"Version\");\n        if (v7Version == null) return tagVersions;\n\n        return Map.of(INDEX_VERSION_TYPE, v7Version);\n    }\n\n    private static final Pattern VERSION_LINE = Pattern.compile(\"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+),(\\\\d+)\");\n\n    static Optional<List<String>> addVersionRecord(List<String> versionRecordLines, Version release, int id) {\n        Map<Version, Integer> versions = versionRecordLines.stream().map(l -> {\n            Matcher m = VERSION_LINE.matcher(l);\n            if (m.matches() == false) throw new IllegalArgumentException(String.format(\"Incorrect format for line [%s]\", l));\n            return m;\n        }).collect(Collectors.toMap(m -> Version.fromString(m.group(1)), m -> Integer.parseInt(m.group(2))));\n\n        Integer existing = versions.putIfAbsent(release, id);\n        if (existing != null) {\n            if (existing.equals(id)) {\n                LOGGER.lifecycle(\"Version id [{}] for release [{}] already recorded\", id, release);\n                return Optional.empty();\n            } else {\n                throw new IllegalArgumentException(\n                    String.format(\n                        \"Release [%s] already recorded with version id [%s], cannot update to version [%s]\",\n                        release,\n                        existing,\n                        id\n                    )\n                );\n            }","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/TagVersionsTask.java#L87-L123","documentation":"Thrown in TagVersionsTask.addVersionRecord() while parsing the existing version-record file: every line must match (\\d+\\.\\d+\\.\\d+),(\\d+). Any line that does not match (blank, comment, malformed, BOM, wrong separator) aborts the whole parse.","triggerScenarios":"The record file (e.g. the INDEX_VERSIONS_RECORD file under rootDir) contains a non-conforming line — a trailing blank line with whitespace, a hand edit, a CRLF/encoding artefact, or a stale entry written by an older format.","commonSituations":"Someone manually edited the version record file; a merge introduced a stray line; the file was written with a different separator on another OS.","solutions":["Inspect the record file at rootDir/INDEX_VERSIONS_RECORD and fix or remove any line not matching <major>.<minor>.<patch>,<id>.","Strip trailing whitespace/blank lines and ensure consistent LF line endings.","Re-derive the file from git history if a clean version is available."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-validate the record file lines\nprivate static final Pattern REC = Pattern.compile(\"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+),(\\\\d+)\");\nstatic List<String> sanitize(List<String> lines) {\n    List<String> bad = lines.stream().filter(l -> !l.isBlank() && !REC.matcher(l).matches()).toList();\n    if (!bad.isEmpty()) throw new IllegalStateException(\"Bad record lines: \" + bad);\n    return lines.stream().filter(l -> !l.isBlank()).toList();\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-edit the version record file; only the task should write it.","Add a pre-commit hook that validates the record file format."],"tags":["release-tooling","file-parsing","version-record","data-integrity"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}