{"record":{"id":"a37a2e7df7ad860f","repo":"prestodb/presto","slug":"prometheus-parse-error","errorCode":"PROMETHEUS_PARSE_ERROR","errorMessage":"Unable to parse Prometheus response: ","messagePattern":"Unable to parse Prometheus response: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusQueryResponse.java","lineNumber":100,"sourceCode":"                                    parser.nextToken();\n                                    ArrayNode node = mapper.readTree(parser);\n                                    result = node.toString();\n                                    break;\n                                }\n                            }\n                        }\n                    }\n                    else {\n                        //error path\n                        String parsedStatus = parser.getValueAsString();\n                        //parsing json is key-value based, so first nextToken is advanced to the key, nextToken advances to the value.\n                        parser.nextToken(); // for \"errorType\" key\n                        parser.nextToken(); // for \"errorType\" key's value\n                        errorType = parser.getValueAsString();\n                        parser.nextToken(); // advance to \"error\" key\n                        parser.nextToken(); // advance to \"error\" key's value\n                        error = parser.getValueAsString();\n                        throw new PrestoException(PROMETHEUS_PARSE_ERROR, \"Unable to parse Prometheus response: \" + parsedStatus + \" \" + errorType + \" \" + error);\n                    }\n                }\n            }\n            if (result != null) {\n                break;\n            }\n        }\n        if (result != null && resultType != null) {\n            switch (resultType) {\n                case matrix:\n                case vector:\n                    results = mapper.readValue(result, new TypeReference<List<PrometheusMetricResult>>() {});\n                    break;\n                case scalar:\n                case string:\n                    PrometheusTimeSeriesValue stringOrScalarResult = mapper.readValue(result, new TypeReference<PrometheusTimeSeriesValue>() {});\n                    Map<String, String> madeUpMetricHeader = new HashMap<>();\n                    madeUpMetricHeader.put(\"__name__\", resultType.toString());","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusQueryResponse.java#L82-L118","documentation":"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.","triggerScenarios":"Thrown at presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusQueryResponse.java:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the Prometheus server's HTTP response for an API error status/message","Verify the connector targets a compatible Prometheus API version","Inspect for proxies/gateways altering the response body"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}