prestodb/presto · critical · PrestoException
REST_SERVER_FUNCTION_FETCH_ERROR
REST_SERVER_FUNCTION_FETCH_ERROR
Error message
Failed to fetch function definitions from REST server:
What it means
RestBasedFunctionApis.getFunctionsAt wraps all failures of the HTTP call to the remote function server (connection errors, timeouts, non-2xx responses, malformed JSON) into a PrestoException with code REST_SERVER_FUNCTION_FETCH_ERROR. It signals that function definitions could not be retrieved from the REST endpoint, with the underlying cause's message appended.
Source
Thrown at presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestBasedFunctionApis.java:107
}
private UdfFunctionSignatureMap getFunctionsAt(String endpoint)
throws IllegalStateException
{
try {
URI uri = uriBuilderFrom(URI.create(restUrl))
.appendPath(endpoint)
.build();
Request request = Request.builder()
.prepareGet()
.setUri(uri)
.build();
Map<String, List<JsonBasedUdfFunctionMetadata>> nativeFunctionSignatureMap = httpClient.execute(request, createJsonResponseHandler(functionSignatureMapJsonCodec));
return new UdfFunctionSignatureMap(ImmutableMap.copyOf(nativeFunctionSignatureMap));
}
catch (Exception e) {
throw new PrestoException(REST_SERVER_FUNCTION_FETCH_ERROR, "Failed to fetch function definitions from REST server: " + e.getMessage(), e);
}
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Check the embedded cause message and verify the REST server is up: curl the configured functions endpoint from the coordinator host
- Fix catalog properties (rest server URL, endpoint path, auth) to point at the correct, reachable server
- Check network path (DNS, firewall, proxy) and retry once the server is healthy; ensure server response format matches the expected JSON codec
Example fix
// before function-namespace.url=http://functions-internal:8080/wrong-path // after function-namespace.url=http://functions-internal:8080/v1/functions
Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight: ensure the REST server answers before planning queries
HttpResponse<String> resp = sendGet(restServerUrl + "/v1/functions/health");
if (resp.statusCode() != 200) throw new IllegalStateException("REST function server unhealthy"); Try / catch
try {
functions = manager.getFunctions(functionName);
} catch (PrestoException e) {
if (e.getErrorCode().getName().equals("REST_SERVER_FUNCTION_FETCH_ERROR")) {
// retry with backoff; log cause from e.getCause()
} else throw e;
} Prevention
- Monitor the REST function server's health from coordinator hosts
- Validate catalog REST URL/credentials after every config change
- Set client timeouts and retries for the function-namespace HTTP client
- Keep server response schema in sync with the client JSON codec on upgrades
When it happens
Trigger: Calling getAllFunctions or getFunctions when the REST server is unreachable, returns an HTTP error, times out, or returns a body that fails JSON decoding into UdfFunctionSignatureMap.
Common situations: REST function service down or redeploying; wrong REST server URI in catalog config; network/firewall or DNS issues from coordinator; server returning an unexpected payload after an API version change; missing auth credentials causing 401/403.
Related errors
- NOT_SUPPORTED
- NOT_SUPPORTED
- ARROW_FLIGHT_CLIENT_ERROR
- Response does not contain a JSON value
- Failed to resolve host:
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/70242d25ff87beaa.
Report an issue: GitHub.