{"record":{"id":"ba61ffdf89cb75a6","repo":"elastic/elasticsearch","slug":"failed-to-read-http-ports-file-for","errorCode":null,"errorMessage":"Failed to read http ports file: {} for {}","messagePattern":"Failed to read http ports file: (.+?) for (.+?)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java","lineNumber":1567,"sourceCode":"    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    }\n\n    private List<String> getRemoteAccessPortInternal() {\n        try {\n            return readPortsFile(remoteAccessPortsFile);\n        } catch (IOException e) {\n            return new ArrayList<>();\n        }\n    }","sourceCodeStart":1549,"sourceCodeEnd":1585,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java#L1549-L1585","documentation":"Sibling of error 93: thrown by getHttpPortInternal() when readPortsFile(httpPortsFile) throws IOException. Same lifecycle — the http ports file is written by ES on startup and read back to discover the bound HTTP port for REST clients.","triggerScenarios":"getHttpPort()/getHttpSocketURI() is called before ES wrote the http ports file, or the file is missing/unreadable. Note: getReadinessPortInternal() swallows IOException and returns empty list — only http and transport throw.","commonSituations":"Calling getHttpPort() during a too-early readiness probe; node crashed before binding HTTP; the ports file was deleted by a concurrent cleanup; permissions issue on the ports file.","solutions":["Use the cluster's built-in waitForHttp / readiness mechanism rather than reading ports manually.","Check esOutputFile to confirm ES bound the HTTP port (look for 'publish_address' under http).","Ensure the working dir is not being concurrently cleaned.","Re-run in isolation if cross-test interference is suspected."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (Files.notExists(httpPortsFile)) {\n    return List.of();\n}","typeGuard":null,"tryCatchPattern":"try {\n    return readPortsFile(httpPortsFile);\n} catch (IOException e) {\n    throw new UncheckedIOException(\"Failed to read http ports file: \" + httpPortsFile + \" for \" + this, e);\n}","preventionTips":["Use the cluster's waitForHttp readiness gate rather than reading ports manually.","Confirm ES bound the HTTP port via the log file before reading.","Do not let teardown race with port reads."],"tags":["testclusters","ports","http","io"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}