elastic/elasticsearch · error · IOException
Invalid transport version data file [{}]: {}
Error message
Invalid transport version data file [{}]: {} What it means
IOException from TransportVersionReference.listFromFile() when a line in a transport-version references CSV file does not split into exactly 2 comma-separated fields (name, location). The CSV must have a consistent two-column shape.
Source
Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/TransportVersionReference.java:37
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static org.gradle.api.artifacts.type.ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE;
record TransportVersionReference(String name, String location) {
private static final Attribute<Boolean> REFERENCES_ATTRIBUTE = Attribute.of("transport-version-references", Boolean.class);
static List<TransportVersionReference> listFromFile(Path file) throws IOException {
assert file.toString().endsWith(".csv") : file + " does not end in .csv";
List<TransportVersionReference> results = new ArrayList<>();
for (String line : Files.readAllLines(file, StandardCharsets.UTF_8)) {
String[] parts = line.split(",", 2);
if (parts.length != 2) {
throw new IOException("Invalid transport version data file [" + file + "]: " + line);
}
results.add(new TransportVersionReference(parts[0], parts[1]));
}
return results;
}
static void addArtifactAttribute(AttributeContainer attributes) {
attributes.attribute(ARTIFACT_TYPE_ATTRIBUTE, "csv");
attributes.attribute(REFERENCES_ATTRIBUTE, true);
}
static Set<String> collectNames(Iterable<File> referencesFiles) throws IOException {
Set<String> names = new HashSet<>();
for (var referencesFile : referencesFiles) {
listFromFile(referencesFile.toPath()).stream().map(TransportVersionReference::name).forEach(names::add);
}
return names;
}View on GitHub (pinned to db6a809a66)
Solutions
- Open the file at the reported path and find the offending line shown in the message.
- Ensure each line has exactly one comma separating name from location; quote/escape if location may contain commas.
- Regenerate the references file via CollectTransportVersionReferencesTask to restore the canonical format.
Example fix
// before: my_feature,org.elasticsearch.Foo line 1,2 // after: my_feature,org.elasticsearch.Foo line 12
Defensive patterns
Strategy: validation
Validate before calling
for (String line : Files.readAllLines(file, StandardCharsets.UTF_8)) {
String[] parts = line.split(",", 2);
if (parts.length != 2 || parts[0].isBlank() || parts[1].isBlank()) {
throw new IOException("Invalid references line in " + file + ": " + line);
}
} Type guard
static boolean isValidReferenceLine(String line) {
String[] p = line.split(",", 2);
return p.length == 2 && !p[0].isBlank() && !p[1].isBlank();
} Prevention
- Regenerate references CSVs from the collection task rather than editing by hand.
- Quote the location field if it can contain commas, or strip commas from it.
- Add a CI lint that rejects reference lines without exactly two columns.
When it happens
Trigger: A references CSV line has fewer or more than one comma - e.g. an unquoted location containing a comma, a blank line, or a malformed line produced by the collection task.
Common situations: The location field (which embeds 'classname line N') was changed to include an extra comma; a blank/whitespace-only line slipped into the file; the file was concatenated incorrectly.
Related errors
- Failed to parse id {} in {}
- Invalid transport version upper bound file [{}]: {}
- Could not find base id: {}
- Could not find base id: {}
- Invalid increment {}, must be a positive integer
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/d1d805a6608ea787.
Report an issue: GitHub.