{"record":{"id":"70242d25ff87beaa","repo":"prestodb/presto","slug":"rest-server-function-fetch-error","errorCode":"REST_SERVER_FUNCTION_FETCH_ERROR","errorMessage":"Failed to fetch function definitions from REST server: ","messagePattern":"Failed to fetch function definitions from REST server: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"critical","filePath":"presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestBasedFunctionApis.java","lineNumber":107,"sourceCode":"    }\n\n    private UdfFunctionSignatureMap getFunctionsAt(String endpoint)\n            throws IllegalStateException\n    {\n        try {\n            URI uri = uriBuilderFrom(URI.create(restUrl))\n                    .appendPath(endpoint)\n                    .build();\n            Request request = Request.builder()\n                    .prepareGet()\n                    .setUri(uri)\n                    .build();\n\n            Map<String, List<JsonBasedUdfFunctionMetadata>> nativeFunctionSignatureMap = httpClient.execute(request, createJsonResponseHandler(functionSignatureMapJsonCodec));\n            return new UdfFunctionSignatureMap(ImmutableMap.copyOf(nativeFunctionSignatureMap));\n        }\n        catch (Exception e) {\n            throw new PrestoException(REST_SERVER_FUNCTION_FETCH_ERROR, \"Failed to fetch function definitions from REST server: \" + e.getMessage(), e);\n        }\n    }\n}\n","sourceCodeStart":89,"sourceCodeEnd":111,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestBasedFunctionApis.java#L89-L111","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nfunction-namespace.url=http://functions-internal:8080/wrong-path\n// after\nfunction-namespace.url=http://functions-internal:8080/v1/functions","handlingStrategy":"retry","validationCode":"// Pre-flight: ensure the REST server answers before planning queries\nHttpResponse<String> resp = sendGet(restServerUrl + \"/v1/functions/health\");\nif (resp.statusCode() != 200) throw new IllegalStateException(\"REST function server unhealthy\");","typeGuard":null,"tryCatchPattern":"try {\n    functions = manager.getFunctions(functionName);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getName().equals(\"REST_SERVER_FUNCTION_FETCH_ERROR\")) {\n        // retry with backoff; log cause from e.getCause()\n    } else throw e;\n}","preventionTips":["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"],"tags":["network","rest","http-fetch","function-namespace","json"],"backgroundTag":"rest-fetch-failed","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"}