{"record":{"id":"467ef426fd1100c1","repo":"prestodb/presto","slug":"rest-server-timeout","errorCode":"REST_SERVER_TIMEOUT","errorMessage":"Request to REST server timed out. Request: ","messagePattern":"Request to REST server timed out\\. Request: ","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":166,"sourceCode":"        URI baseUri = restFunctionHandle.getExecutionEndpoint()\n                .orElse(URI.create(restBasedFunctionNamespaceManagerConfig.getRestUrl()));\n        String path = format(\"/v1/functions/%s/%s/%s/%s\",\n                functionId.getFunctionName().getSchemaName(),\n                functionId.getFunctionName().getObjectName(),\n                encodedFunctionId,\n                functionVersion);\n\n        return URI.create(String.format(\"%s%s\", baseUri, path));\n    }\n\n    public static class SqlFunctionResultResponseHandler\n            implements ResponseHandler<SqlFunctionResult, RuntimeException>\n    {\n        @Override\n        public SqlFunctionResult handleException(Request request, Exception exception)\n        {\n            if (exception instanceof java.net.SocketTimeoutException) {\n                throw new PrestoException(REST_SERVER_TIMEOUT, \"Request to REST server timed out. Request: \" + request, exception);\n            }\n            else if (exception instanceof java.net.ConnectException) {\n                throw new PrestoException(REST_SERVER_CONNECT_ERROR, \"Failed to connect to REST server. Request: \" + request, exception);\n            }\n            else {\n                throw new PrestoException(REST_SERVER_ERROR, \"Unexpected error during REST call. Request: \" + request + \", Exception: \" + exception.getMessage(), exception);\n            }\n        }\n\n        @Override\n        public SqlFunctionResult handle(Request request, Response response)\n        {\n            if (response.getStatusCode() == HTTP_NOT_FOUND) {\n                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            }","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestSqlFunctionExecutor.java#L148-L184","documentation":"SqlFunctionResultResponseHandler.handleException maps java.net.SocketTimeoutException to this error: the REST function-namespace server did not respond in time while invoking a SqlFunction, so the remote function call timed out.","triggerScenarios":"Thrown at presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestSqlFunctionExecutor.java:166 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Increase the REST client read timeout configuration","Check function-namespace server load and latency","Retry the query once the server responds within the timeout"],"exampleFix":null,"handlingStrategy":"retry","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"}