NationalSecurityAgency/ghidra · error · ElasticException
Error parsing response: {message}
Error message
Error parsing response: {message} What it means
Thrown by ElasticConnection.executeRawStatement when JsonParser.parseReader fails to parse the response body as a JsonObject (JsonParseException). The HTTP call succeeded but the body is not valid JSON or not a JSON object, so grabResponse's getAsJsonObject() / parse fails.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticConnection.java:212
connection.setDoOutput(true);
try (Writer writer = new OutputStreamWriter(connection.getOutputStream())) {
writer.write(body);
}
lastResponseCode = connection.getResponseCode();
JsonObject resp = grabResponse(connection);
if (!lastRequestSuccessful()) {
throw new ElasticException(parseErrorJSON(resp));
}
return resp;
}
catch (URISyntaxException e) {
throw new ElasticException("Error parsing URL: " + e.getMessage());
}
catch (IOException e) {
throw new ElasticException("Error sending request: " + e.getMessage());
}
catch (JsonParseException e) {
throw new ElasticException("Error parsing response: " + e.getMessage());
}
finally {
if (connection != null) {
connection.disconnect();
}
}
}
/**
* Execute an elasticsearch command where we are not expecting a response
* @param command is the type of the command
* @param path is the overarching {@code index/type/<command>}
* @param body is the JSON document describing the request
* @throws ElasticException for any problems with the connecting
*/
public void executeStatementNoResponse(String command, String path, String body)
throws ElasticException {View on GitHub (pinned to d5f144c24d)
Solutions
- Verify the hostURL actually points at Elasticsearch (and not a proxy returning HTML).
- Capture the raw response body (e.g. via curl) to confirm it is a JSON object.
- Check for an intermediate proxy/gateway and bypass or configure it correctly.
- Ensure the ES endpoint path is correct for the command issued.
Defensive patterns
Strategy: validation
Try / catch
try {
return conn.executeRawStatement(command, path, body);
} catch (ElasticException e) {
if (e.getMessage().startsWith("Error parsing response")) {
// capture raw body via curl to confirm it is JSON; check for proxy
} else throw e;
} Prevention
- Point hostURL directly at Elasticsearch, not an HTML-serving proxy.
- Confirm endpoints return JSON objects with curl before integrating.
- Bypass or configure reverse proxies/gateways correctly.
When it happens
Trigger: executeRawStatement where the response body is empty, is HTML (e.g. a proxy error page), is malformed JSON, or is a JSON array/scalar rather than an object. grabResponse parses then calls getAsJsonObject(), which throws on non-object.
Common situations: A reverse proxy/load balancer returning an HTML error page instead of JSON; truncated response body; wrong endpoint returning a non-JSON payload; response encoding issues; an ES plugin intercepting the request.
Related errors
- connection.getResponseMessage()
- {type} : {reason}
- Error sending request: {message}
- Error parsing response:
- Bad base64 encoding
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/01a5a11efad9a1b7.
Report an issue: GitHub.