{"record":{"id":"c20f8223c81fa387","repo":"elastic/elasticsearch","slug":"failed-to-parse-id-in","errorCode":null,"errorMessage":"Failed to parse id {} in {}","messagePattern":"Failed to parse id (.+?) in (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/TransportVersionDefinition.java","lineNumber":41,"sourceCode":"        String idsLine = null;\n        if (contents.isEmpty() == false) {\n            // Regardless of whether windows newlines exist (they could be added by git), we split on line feed.\n            // All we care about skipping lines with the comment character, so the remaining \\r won't matter\n            String[] lines = contents.split(\"\\n\");\n            for (String line : lines) {\n                line = line.strip();\n                if (line.startsWith(\"#\") == false) {\n                    idsLine = line;\n                    break;\n                }\n            }\n        }\n        if (idsLine != null) {\n            for (String rawId : idsLine.split(\",\")) {\n                try {\n                    ids.add(TransportVersionId.fromString(rawId));\n                } catch (NumberFormatException e) {\n                    throw new IllegalStateException(\"Failed to parse id \" + rawId + \" in \" + file, e);\n                }\n            }\n        }\n\n        return new TransportVersionDefinition(name, ids, isReferable);\n    }\n}\n","sourceCodeStart":23,"sourceCodeEnd":49,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/TransportVersionDefinition.java#L23-L49","documentation":"IllegalStateException from TransportVersionDefinition.fromString() wrapping a NumberFormatException raised by TransportVersionId.fromString(rawId). Each comma-separated id in the definition file must parse as a valid transport-version id integer/string form.","triggerScenarios":"A definition CSV's ids line contains a token that is not a valid TransportVersionId - non-numeric text, a stray comma producing an empty token, or a malformed id format.","commonSituations":"Hand-editing a definition CSV and introducing a typo/whitespace; a merge conflict artifact left in the file; an empty trailing token from a trailing comma.","solutions":["Open the definition file named in the message and inspect each comma-separated id token.","Correct or remove malformed tokens; ensure no trailing/leading empty tokens from stray commas.","Validate against TransportVersionId.fromString's expected format before committing."],"exampleFix":"// before: initial_25.csv contains \"1000000,abc,1000002\"\n// after:  initial_25.csv contains \"1000000,1000001,1000002\"","handlingStrategy":"try-catch","validationCode":"for (String rawId : idsLine.split(\",\")) {\n    String t = rawId.strip();\n    if (t.isEmpty() || !t.matches(\"\\\\d+\")) {\n        throw new IllegalStateException(\"Bad id '\" + rawId + \"' in \" + file);\n    }\n}","typeGuard":"static boolean isValidId(String s) { return s != null && s.matches(\"\\\\d+\"); }","tryCatchPattern":"try {\n    TransportVersionDefinition.fromString(file, contents, isReferable);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Failed to parse id\")) {\n        // report file:token and prompt author to fix the CSV\n        logger.error(\"Malformed definition file {}\", file, e);\n    }\n    throw e;\n}","preventionTips":["Validate CSV id tokens before committing transport-version files.","Avoid trailing commas that produce empty tokens.","Run a lint check over the resources directory in CI."],"tags":["transport-version","csv-parsing","data-integrity","build-tooling"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T11:17:21.771Z"}