{"record":{"id":"6e7dd9267317f049","repo":"prestodb/presto","slug":"rest-server-io-error","errorCode":"REST_SERVER_IO_ERROR","errorMessage":"Error deserializing REST server response: ","messagePattern":"Error deserializing REST server response: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestSqlFunctionExecutor.java","lineNumber":198,"sourceCode":"                throw new PrestoException(REST_SERVER_NOT_FOUND, \"Resource not found on REST server. Request: \" + request);\n            }\n            else if (response.getStatusCode() == HTTP_SERVER_ERROR) {\n                throw new PrestoException(REST_SERVER_ERROR, \"Internal server error on REST server. Request: \" + request);\n            }\n            else if (response.getStatusCode() != HTTP_OK) {\n                throw new PrestoException(REST_SERVER_BAD_RESPONSE, \"Unexpected response code: \" + response.getStatusCode() + \". Request: \" + request);\n            }\n\n            try {\n                SliceInput input = new InputStreamSliceInput(response.getInputStream());\n                SerializedPage serializedPage = readSerializedPage(input);\n                Page page = pageSerde.deserialize(serializedPage);\n                checkArgument(page.getChannelCount() == 1, \"Expected only one channel in the function output\");\n                SqlFunctionResult output = new SqlFunctionResult(page.getBlock(0), 1);\n                return output;\n            }\n            catch (IOException e) {\n                throw new PrestoException(REST_SERVER_IO_ERROR, \"Error deserializing REST server response: \" + e.getMessage(), e);\n            }\n        }\n    }\n\n    public static class SqlResultFutureCallback\n            implements FutureCallback<SqlFunctionResult>\n    {\n        @Override\n        public void onSuccess(SqlFunctionResult result)\n        {\n            result.getResult();\n        }\n\n        @Override\n        public void onFailure(Throwable t)\n        {\n            if (t instanceof PrestoException) {\n                throw (PrestoException) t;","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestSqlFunctionExecutor.java#L180-L216","documentation":"After a 200 response, the JSON body of the function-execution reply could not be deserialized into SqlFunctionResult — the REST server returned malformed or unexpected JSON, raising this REST_SERVER_BAD_RESPONSE error.","triggerScenarios":"Thrown at presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestSqlFunctionExecutor.java:198 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the REST server response format matches the expected schema","Align client and server versions for the response codec","Inspect the raw response body for proxy/HTML error pages"],"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"}