{"record":{"id":"447fa5a9f0ff97f1","repo":"prestodb/presto","slug":"pinot-exception","errorCode":"PINOT_EXCEPTION","errorMessage":"Query %s encountered exception %s","messagePattern":"Query (.+?) encountered exception (.+?)","errorType":"error_code","errorClass":"PinotException","httpStatus":null,"severity":"error","filePath":"presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotBrokerPageSource.java","lineNumber":298,"sourceCode":"\n        if (numServersQueried == null || numServersResponded == null || numServersQueried.asInt() > numServersResponded.asInt()) {\n            throw new PinotException(\n                PINOT_INSUFFICIENT_SERVER_RESPONSE,\n                Optional.of(pinotQuery),\n                String.format(\"Only %s out of %s servers responded for query %s\", numServersResponded.asInt(), numServersQueried.asInt(), pinotQuery));\n        }\n\n        JsonNode exceptions = jsonBody.get(\"exceptions\");\n        if (exceptions != null && exceptions.isArray() && exceptions.size() > 0) {\n            if (exceptions.get(0).get(\"errorCode\").asInt() == 180) {\n                throw new PinotException(\n                    PINOT_UNAUTHENTICATED_EXCEPTION,\n                    Optional.empty(),\n                    \"Query authentication failed.\");\n            }\n            // Pinot is known to return exceptions with benign errorcodes like 200\n            // so we treat any exception as an error\n            throw new PinotException(\n                PINOT_EXCEPTION,\n                Optional.of(pinotQuery),\n                String.format(\"Query %s encountered exception %s\", pinotQuery, exceptions.get(0)));\n        }\n    }\n\n    protected static String asText(JsonNode node)\n    {\n        if (node.isArray()) {\n            String[] results = new String[node.size()];\n            for (int i = 0; i < node.size(); i++) {\n                results[i] = asText(node.get(i));\n            }\n            return Arrays.toString(results);\n        }\n        checkState(node.isValueNode());\n        return node.isNull() ? null : node.asText();\n    }","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotBrokerPageSource.java#L280-L316","documentation":"Thrown when the Pinot broker response contains a non-empty 'exceptions' array whose first entry does not have errorCode 180. Any broker-reported exception is surfaced as a PinotException carrying the full first exception JSON (code, message) alongside the original query.","triggerScenarios":"handleCommonResponse finds exceptions array with size > 0 and first errorCode != 180; the exact Pinot error (e.g. query timeout, bad query, segment load failure) is embedded in exceptions.get(0) in the message.","commonSituations":"Pinot broker query timeouts, invalid PQL/SQL rejected by Pinot, quota/broker limits hit, server-side segment errors surfaced through the broker.","solutions":["Read the embedded exception JSON in the message: its 'errorCode' and 'message' name the underlying Pinot failure","If it is a query timeout (errorCode 200/410 style), reduce query scope or raise Pinot broker timeout (query.timeoutMs)","Validate the generated SQL/PQL against Pinot's supported syntax for your Pinot version","Check Pinot broker/server logs for the query id to see the full stack trace"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    connector.query(sql);\n} catch (PinotException e) {\n    if (e.getErrorCode() == PinotErrorCode.PINOT_EXCEPTION) {\n        // parse the embedded exception JSON in e.getMessage() to get the\n        // real Pinot errorCode/message, then branch on it\n    }\n    throw e;\n}","preventionTips":["Validate SQL syntax against your Pinot version's supported feature set","Keep broker query timeout configured above worst-case query latency","Check Pinot broker/server logs (by query id) for root causes"],"tags":["pinot","broker-error","query-execution"],"backgroundTag":"broker-query-exception","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"}