{"record":{"id":"876a6279843654c7","repo":"elastic/elasticsearch","slug":"failed-to-read-transport-ports-file-for","errorCode":null,"errorMessage":"Failed to read transport ports file: {} for {}","messagePattern":"Failed to read transport ports file: (.+?) for (.+?)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java","lineNumber":1559,"sourceCode":"            // temporarily check the old substitution first so both old and new work during backport\n            errorFileSub = new ReplacementKey(\"-XX:ErrorFile=logs/hs_err_pid%p.log\", \"-XX:ErrorFile=hs_err_pid%p.log\");\n        }\n        expansions.put(errorFileSub, \"-XX:ErrorFile=\" + confPathLogs.resolve(\"hs_err_pid%p.log\"));\n\n        return expansions;\n    }\n\n    private void checkFrozen() {\n        if (configurationFrozen.get()) {\n            throw new IllegalStateException(\"Configuration for \" + this + \" can not be altered, already locked\");\n        }\n    }\n\n    private List<String> getTransportPortInternal() {\n        try {\n            return readPortsFile(transportPortFile);\n        } catch (IOException e) {\n            throw new UncheckedIOException(\"Failed to read transport ports file: \" + transportPortFile + \" for \" + this, e);\n        }\n    }\n\n    private List<String> getHttpPortInternal() {\n        try {\n            return readPortsFile(httpPortsFile);\n        } catch (IOException e) {\n            throw new UncheckedIOException(\"Failed to read http ports file: \" + httpPortsFile + \" for \" + this, e);\n        }\n    }\n\n    private List<String> getReadinessPortInternal() {\n        try {\n            return readPortsFile(readinessPortsFile);\n        } catch (IOException e) {\n            return new ArrayList<>();\n        }\n    }","sourceCodeStart":1541,"sourceCodeEnd":1577,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java#L1541-L1577","documentation":"Thrown by getTransportPortInternal() when readPortsFile(transportPortFile) throws IOException. The transport ports file is written by ES on startup; this method reads it back to discover which port the node bound to. Failure means the file is missing, unreadable, or malformed.","triggerScenarios":"Called during getTransportPort()/getTransportSocketURI() before ES has finished writing the ports file, after the file was deleted, or when the node never started successfully enough to bind the transport port.","commonSituations":"Polling the node's transport port too early in the startup wait loop; the node crashed before writing transport ports; a previous run's ports file was not cleaned up and is stale/unreadable; concurrency where teardown deleted the file mid-read.","solutions":["Confirm the node actually started (check esOutputFile for the 'started' line and any startup exception).","Wait for node readiness via the built-in wait logic before querying ports.","Ensure no parallel teardown is deleting the working dir while ports are being read.","Re-run the test in isolation to rule out cross-cluster file races."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (Files.notExists(transportPortFile)) {\n    return List.of();  // or wait for readiness first\n}","typeGuard":null,"tryCatchPattern":"try {\n    return readPortsFile(transportPortFile);\n} catch (IOException e) {\n    throw new UncheckedIOException(\"Failed to read transport ports file: \" + transportPortFile + \" for \" + this, e);\n}","preventionTips":["Wait for node readiness via the built-in wait logic before reading transport ports.","Confirm ES wrote the ports file (check esOutputFile) before querying.","Avoid concurrent teardown that deletes the working dir."],"tags":["testclusters","ports","transport","io"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}