prestodb/presto · error · PrestoException

PROMETHEUS_PARSE_ERROR

PROMETHEUS_PARSE_ERROR

Error message

Unable to parse Prometheus response: 

What it means

Parse failure in parsePrometheusQueryResponse: the HTTP response body does not match the expected Prometheus query-result JSON structure (status/data tree), so the parser cannot extract results and reports 'Unable to parse Prometheus response: ...' with the raw status text. Fires on unexpected API responses such as errors or non-standard proxies.

Source

Thrown at presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusQueryResponse.java:100

                                    parser.nextToken();
                                    ArrayNode node = mapper.readTree(parser);
                                    result = node.toString();
                                    break;
                                }
                            }
                        }
                    }
                    else {
                        //error path
                        String parsedStatus = parser.getValueAsString();
                        //parsing json is key-value based, so first nextToken is advanced to the key, nextToken advances to the value.
                        parser.nextToken(); // for "errorType" key
                        parser.nextToken(); // for "errorType" key's value
                        errorType = parser.getValueAsString();
                        parser.nextToken(); // advance to "error" key
                        parser.nextToken(); // advance to "error" key's value
                        error = parser.getValueAsString();
                        throw new PrestoException(PROMETHEUS_PARSE_ERROR, "Unable to parse Prometheus response: " + parsedStatus + " " + errorType + " " + error);
                    }
                }
            }
            if (result != null) {
                break;
            }
        }
        if (result != null && resultType != null) {
            switch (resultType) {
                case matrix:
                case vector:
                    results = mapper.readValue(result, new TypeReference<List<PrometheusMetricResult>>() {});
                    break;
                case scalar:
                case string:
                    PrometheusTimeSeriesValue stringOrScalarResult = mapper.readValue(result, new TypeReference<PrometheusTimeSeriesValue>() {});
                    Map<String, String> madeUpMetricHeader = new HashMap<>();
                    madeUpMetricHeader.put("__name__", resultType.toString());

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Check the Prometheus server's HTTP response for an API error status/message
  2. Verify the connector targets a compatible Prometheus API version
  3. Inspect for proxies/gateways altering the response body
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusQueryResponse.java:100 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/a37a2e7df7ad860f. Report an issue: GitHub.