{"record":{"id":"012e6f11661705e2","repo":"NationalSecurityAgency/ghidra","slug":"connection-getresponsemessage","errorCode":null,"errorMessage":"connection.getResponseMessage()","messagePattern":"connection\\.getResponseMessage\\(\\)","errorType":"http","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticConnection.java","lineNumber":94,"sourceCode":"\t/**\n\t * Assuming the writer has been closed and connection.getResponseCode() is called\n\t * placing the value in lastResponseCode, read the response and parse into a JsonObject\n\t * @return the JsonObject\n\t * @throws IOException for problems with the socket\n\t * @throws JsonParseException for JSON parse errors\n\t */\n\tprivate JsonObject grabResponse(HttpURLConnection connection)\n\t\t\tthrows IOException, JsonParseException {\n\t\tInputStream in;\n\t\tif (lastRequestSuccessful()) {\n\t\t\tin = connection.getInputStream();\n\t\t}\n\t\telse {\n\t\t\tin = connection.getErrorStream();\n\t\t}\n\t\tif (in == null) {\n\t\t\t// Connection error occurred\n\t\t\tthrow new IOException(connection.getResponseMessage());\n\t\t}\n\t\tReader reader = new InputStreamReader(in);\n\t\tJsonObject jsonObject = JsonParser.parseReader(reader).getAsJsonObject();\n\t\treturn jsonObject;\n\t}\n\n\t/**\n\t * Elastic search sends a JSON document in the Http error stream for any error\n\t * Pull out relevant info from the document and construct an exception message\n\t * @param resp is the parsed error document\n\t * @return the exception String\n\t */\n\tprivate static String parseErrorJSON(JsonObject resp) {\n\t\tObject errorObj = resp.get(\"error\");\n\t\tif (errorObj instanceof String) {\n\t\t\treturn (String) errorObj;\n\t\t}\n\t\tif (!(errorObj instanceof JsonObject err)) {","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticConnection.java#L76-L112","documentation":"Thrown by ElasticConnection.grabResponse when the HTTP input stream (or error stream) is null, meaning the connection did not yield any response body. It wraps connection.getResponseMessage() in an IOException and is re-thrown to callers as part of executeRawStatement/executeStatementNoResponse IOException handling. This indicates a transport-level failure rather than an Elasticsearch error document.","triggerScenarios":"grabResponse reads connection.getInputStream() (on success) or connection.getErrorStream() (on failure); if both are null it throws IOException(getResponseMessage()). Reached whenever the HTTP connection is established but no body is returned (e.g. server reset, DNS-level redirect, proxy dropping the body).","commonSituations":"Elasticsearch server down or restarted mid-request; network/proxy timeout severing the response; misconfigured hostURL pointing at a non-ES service; TLS/firewall reset; the server returned a status with no body.","solutions":["Verify the Elasticsearch host is reachable and healthy (curl the cluster health endpoint).","Check hostURL/credentials configuration in the BSim database settings.","Inspect network/proxy/firewall between the Ghidra client and the ES host.","Retry after confirming the ES process is up and the port is correct."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return conn.executeRawStatement(cmd, path, body);\n} catch (ElasticException e) {\n    if (e.getCause() instanceof IOException && e.getMessage().contains(\"getResponseMessage\")) {\n        // retry after confirming server health\n    } else throw e;\n}","preventionTips":["Keep the Elasticsearch endpoint healthy and reachable.","Validate hostURL configuration before opening a connection.","Monitor cluster health to catch downtime before issuing requests."],"tags":["bsim","elastic","network","connection","java"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}