prestodb/presto · error · PrestoException
GENERIC_USER_ERROR
GENERIC_USER_ERROR
Error message
Function namespace not found for catalog: %s
What it means
listFunctions looks up the function namespace manager serving the default namespace's catalog when the session lists built-in functions only. If no manager is registered for that catalog, it throws GENERIC_USER_ERROR: the requested catalog has no function namespace manager at all.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/metadata/FunctionAndTypeManager.java:560
builtInPluginFunctionNamespaceManager = new BuiltInTypeAndFunctionNamespaceManager(blockEncodingSerde, functionsConfig, types, this, false);
addFunctionNamespace(catalogName, builtInPluginFunctionNamespaceManager);
}
((BuiltInTypeAndFunctionNamespaceManager) builtInPluginFunctionNamespaceManager).registerBuiltInFunctions(functions);
}
/**
* likePattern / escape is an opportunistic optimization push down to function namespace managers.
* Not all function namespace managers can handle it, thus the returned function list could
* include functions that doesn't comply with the pattern specified. Specifically, all session
* functions and builtin functions will always be included in the returned set. So proper handling
* is still needed in `ShowQueriesRewrite`.
*/
public List<SqlFunction> listFunctions(Session session, Optional<String> likePattern, Optional<String> escape)
{
ImmutableList.Builder<SqlFunction> functions = new ImmutableList.Builder<>();
if (isListBuiltInFunctionsOnly(session)) {
if (!functionNamespaceManagers.containsKey(defaultNamespace.getCatalogName())) {
throw new PrestoException(GENERIC_USER_ERROR, format("Function namespace not found for catalog: %s", defaultNamespace.getCatalogName()));
}
functions.addAll(functionNamespaceManagers.get(
defaultNamespace.getCatalogName()).listFunctions(likePattern, escape).stream()
.collect(toImmutableList()));
functions.addAll(builtInPluginFunctionNamespaceManager.listFunctions(likePattern, escape).stream().collect(toImmutableList()));
functions.addAll(builtInWorkerFunctionNamespaceManager.listFunctions(likePattern, escape).stream().collect(toImmutableList()));
}
else {
Set<String> catalogsToListFunction = getNonBuiltInFunctionNamespacesToListFunctions(session);
functions.addAll(SessionFunctionUtils.listFunctions(session.getSessionFunctions()));
functions.addAll(functionNamespaceManagers.values().stream()
.filter(x -> x instanceof BuiltInTypeAndFunctionNamespaceManager || catalogsToListFunction.isEmpty() || catalogsToListFunction.contains(x.getCatalogName()))
.flatMap(manager -> manager.listFunctions(likePattern, escape).stream())
.collect(toImmutableList()));
functions.addAll(builtInPluginFunctionNamespaceManager.listFunctions(likePattern, escape).stream().collect(toImmutableList()));
functions.addAll(builtInWorkerFunctionNamespaceManager.listFunctions(likePattern, escape).stream().collect(toImmutableList()));
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Verify the catalog name is correct and registered in the default namespace configuration.
- Ensure the connector/plugin providing the catalog's function namespace is installed and loaded.
- Check server startup logs for function namespace manager registration failures.
Example fix
// before // listing functions for catalog 'foo' that has no function namespace manager // after // fix etc/catalog/foo.properties so the connector (with function namespace) registers, then retry SHOW FUNCTIONS
Defensive patterns
Strategy: validation
Validate before calling
if (!functionNamespaceManagers.containsKey(defaultNamespace.getCatalogName())) {
throw new IllegalStateException("catalog not registered: " + defaultNamespace.getCatalogName());
} Type guard
boolean catalogHasFunctionNamespace(String catalog, Map<?,?> managers) { return managers.containsKey(catalog); } Try / catch
try { listFunctions(session, like, escape); }
catch (PrestoException e) { if (isGenericUserError(e) && e.getMessage().contains("Function namespace not found")) { checkCatalogConfig(catalog); } else throw e; } Prevention
- Verify catalog properties files before deploying
- Confirm plugin jars land in the plugin directory at startup
- Watch startup logs for namespace manager registration errors
When it happens
Trigger: Calling FunctionAndTypeManager.listFunctions (or its wrappers functions/functionsNoFilter/functionsFilter*) when functionNamespaceManagers lacks an entry for defaultNamespace.getCatalogName() while isListBuiltInFunctionsOnly(session) is true — i.e. listing functions in a catalog with no serving function namespace manager.
Common situations: Querying SHOW FUNCTIONS against a catalog whose connector/plugin failed to register a function namespace; misconfigured catalog name in the default namespace; using a session before the remote/plugin function namespace manager is wired.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/1a6ed87c767712de.
Report an issue: GitHub.