prestodb/presto · error · PrestoException

REST_SERVER_CONNECT_ERROR

REST_SERVER_CONNECT_ERROR

Error message

Failed to connect to REST server. Request: 

What it means

handleException maps java.net.ConnectException to this error: a TCP connection to the REST function-namespace server could not be established (server down or wrong restUrl), so the SqlFunction invocation failed.

Source

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

                functionId.getFunctionName().getSchemaName(),
                functionId.getFunctionName().getObjectName(),
                encodedFunctionId,
                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);
            }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify the REST server URL and that the service is up
  2. Check network/firewall reachability from the worker
  3. Retry after restoring the REST server
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestSqlFunctionExecutor.java:169 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/113aa89515915868. Report an issue: GitHub.