{"record":{"id":"cb9b15254a651433","repo":"prestodb/presto","slug":"pinot-unexpected-response-cb9b15","errorCode":"PINOT_UNEXPECTED_RESPONSE","errorMessage":"Encountered Pinot exceptions, unknown response type - %s","messagePattern":"Encountered Pinot exceptions, unknown response type - (.+?)","errorType":"error_code","errorClass":"PinotException","httpStatus":null,"severity":"error","filePath":"presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotSegmentPageSource.java","lineNumber":226,"sourceCode":"                            checkExceptions(dataTable, split, PinotSessionProperties.isMarkDataFetchExceptionsAsRetriable(session));\n                            currentDataTable = new PinotSegmentPageSource.PinotDataTableWithSize(dataTable, serverResponse.getSerializedSize());\n                        }\n                        catch (IOException e) {\n                            throw new PinotException(\n                                PINOT_DATA_FETCH_EXCEPTION,\n                                split.getSegmentPinotQuery(),\n                                String.format(\"Encountered Pinot exceptions when fetching data table from Split: < %s >\", split),\n                                e);\n                        }\n                        break;\n                    case CommonConstants.Query.Response.ResponseType.METADATA:\n                        // The last part of the response is Metadata\n                        currentDataTable = null;\n                        serverResponseIterator = null;\n                        close();\n                        return null;\n                    default:\n                        throw new PinotException(\n                            PINOT_UNEXPECTED_RESPONSE,\n                            split.getSegmentPinotQuery(),\n                            String.format(\"Encountered Pinot exceptions, unknown response type - %s\", responseType));\n                }\n            }\n            Page page = fillNextPage();\n            completedPositions += currentDataTable.getDataTable().getNumberOfRows();\n            return page;\n        }\n        finally {\n            if (byteBuffer != null) {\n                ((Buffer) byteBuffer).clear();\n            }\n        }\n    }\n\n    private Iterator<Server.ServerResponse> queryPinot(PinotSplit split)\n    {","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotSegmentPageSource.java#L208-L244","documentation":"Pinot's broker returned a server response whose type the page source iterator does not recognize. This is a defensive default branch in the switch over response types in getNextPage; it means the response protocol between Presto and Pinot diverged from what this connector expects.","triggerScenarios":"getNextPage iterates server responses from queryPinot and hits a ServerResponse subtype or error type not covered by the switch (e.g. a new Pinot protocol response type, metadata-only response arriving in an unexpected position, or a version mismatch between the Pinot client libs and the broker).","commonSituations":"Upgrading the Pinot broker to a version that emits new response types while the connector was built against older Pinot jars; corrupted or interleaved gRPC responses; broker-side errors surfaced as an unrecognized response class.","solutions":["Check broker and Presto Pinot connector version compatibility and align the pinot-segment-spi/client dependency versions with the broker version","Log the full response type and the segment query from the exception and compare against the switch cases in PinotSegmentPageSource.getNextPage","Retry the query; if it reproduces on one segment only, inspect that segment/broker health","Upgrade or patch the connector to handle the new response type"],"exampleFix":"// before\ndefault:\n    throw new PinotException(PINOT_UNEXPECTED_RESPONSE, split.getSegmentPinotQuery(),\n        String.format(\"Encountered Pinot exceptions, unknown response type - %s\", responseType));\n// after\n// add a case for the new response type reported in the message\ncase ERROR:\n    throw new PinotException(PINOT_EXCEPTION_DURING_QUERY, split.getSegmentPinotQuery(),\n        \"Pinot server returned error response: \" + dataTable);\ncase METADATA:\n    currentDataTable = dataTable; break;","handlingStrategy":"retry","validationCode":"// before query: verify connector Pinot client version matches broker\nString brokerVersion = pinotBrokerAdmin.getVersion();\nassert brokerVersion.startsWith(expectedPinotClientMajorVersion);","typeGuard":"boolean isKnownResponseType(Server.ServerResponse r) {\n  return r.hasMetadata() || r.hasDataTable() || r.hasException();\n}","tryCatchPattern":"try {\n  page = pageSource.getNextPage();\n} catch (PinotException e) {\n  if (PinotErrorCode.PINOT_UNEXPECTED_RESPONSE.toErrorCodeObject().equals(e.getErrorCode())) {\n    log.warn(\"Unknown pinot response type for query %s, retrying\", e.getPushDownQuery());\n    pageSource.close(); pageSource = openFreshSource(); page = pageSource.getNextPage();\n  } else throw e;\n}","preventionTips":["Keep connector Pinot dependency versions aligned with the broker version","Log responseType on mismatch to speed up protocol diagnosis","Pin broker upgrades to connector upgrade windows","Test queries against a staging broker before production rollout"],"tags":["pinot","grpc-response","protocol-mismatch"],"backgroundTag":"unexpected-server-response","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"}