prestodb/presto · error · PrestoException

REST_SERVER_ERROR

REST_SERVER_ERROR

Error message

Unexpected error during REST call. Request: 

What it means

Catch-all branch of handleException: any exception other than timeout or connect failure (DNS errors, TLS problems, client bugs) during the REST function call is wrapped in this generic REST_SERVER_ERROR PrestoException.

Source

Thrown at presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestSqlFunctionExecutor.java:172

                functionVersion);

        return URI.create(String.format("%s%s", baseUri, path));
    }

    public static class SqlFunctionResultResponseHandler
            implements ResponseHandler<SqlFunctionResult, RuntimeException>
    {
        @Override
        public SqlFunctionResult handleException(Request request, Exception exception)
        {
            if (exception instanceof java.net.SocketTimeoutException) {
                throw new PrestoException(REST_SERVER_TIMEOUT, "Request to REST server timed out. Request: " + request, exception);
            }
            else if (exception instanceof java.net.ConnectException) {
                throw new PrestoException(REST_SERVER_CONNECT_ERROR, "Failed to connect to REST server. Request: " + request, exception);
            }
            else {
                throw new PrestoException(REST_SERVER_ERROR, "Unexpected error during REST call. Request: " + request + ", Exception: " + exception.getMessage(), exception);
            }
        }

        @Override
        public SqlFunctionResult handle(Request request, Response response)
        {
            if (response.getStatusCode() == HTTP_NOT_FOUND) {
                throw new PrestoException(REST_SERVER_NOT_FOUND, "Resource not found on REST server. Request: " + request);
            }
            else if (response.getStatusCode() == HTTP_SERVER_ERROR) {
                throw new PrestoException(REST_SERVER_ERROR, "Internal server error on REST server. Request: " + request);
            }
            else if (response.getStatusCode() != HTTP_OK) {
                throw new PrestoException(REST_SERVER_BAD_RESPONSE, "Unexpected response code: " + response.getStatusCode() + ". Request: " + request);
            }

            try {
                SliceInput input = new InputStreamSliceInput(response.getInputStream());

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Inspect the nested exception for the root cause
  2. Check REST server logs for the corresponding failure
  3. Verify request URI and function version parameters
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestSqlFunctionExecutor.java:172 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/f46a6f372a1bb423. Report an issue: GitHub.