{"record":{"id":"1a6ed87c767712de","repo":"prestodb/presto","slug":"generic-user-error-1a6ed8","errorCode":"GENERIC_USER_ERROR","errorMessage":"Function namespace not found for catalog: %s","messagePattern":"Function namespace not found for catalog: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/metadata/FunctionAndTypeManager.java","lineNumber":560,"sourceCode":"            builtInPluginFunctionNamespaceManager = new BuiltInTypeAndFunctionNamespaceManager(blockEncodingSerde, functionsConfig, types, this, false);\n            addFunctionNamespace(catalogName, builtInPluginFunctionNamespaceManager);\n        }\n        ((BuiltInTypeAndFunctionNamespaceManager) builtInPluginFunctionNamespaceManager).registerBuiltInFunctions(functions);\n    }\n\n    /**\n     * likePattern / escape is an opportunistic optimization push down to function namespace managers.\n     * Not all function namespace managers can handle it, thus the returned function list could\n     * include functions that doesn't comply with the pattern specified. Specifically, all session\n     * functions and builtin functions will always be included in the returned set. So proper handling\n     * is still needed in `ShowQueriesRewrite`.\n     */\n    public List<SqlFunction> listFunctions(Session session, Optional<String> likePattern, Optional<String> escape)\n    {\n        ImmutableList.Builder<SqlFunction> functions = new ImmutableList.Builder<>();\n        if (isListBuiltInFunctionsOnly(session)) {\n            if (!functionNamespaceManagers.containsKey(defaultNamespace.getCatalogName())) {\n                throw new PrestoException(GENERIC_USER_ERROR, format(\"Function namespace not found for catalog: %s\", defaultNamespace.getCatalogName()));\n            }\n            functions.addAll(functionNamespaceManagers.get(\n                            defaultNamespace.getCatalogName()).listFunctions(likePattern, escape).stream()\n                    .collect(toImmutableList()));\n            functions.addAll(builtInPluginFunctionNamespaceManager.listFunctions(likePattern, escape).stream().collect(toImmutableList()));\n            functions.addAll(builtInWorkerFunctionNamespaceManager.listFunctions(likePattern, escape).stream().collect(toImmutableList()));\n        }\n        else {\n            Set<String> catalogsToListFunction = getNonBuiltInFunctionNamespacesToListFunctions(session);\n            functions.addAll(SessionFunctionUtils.listFunctions(session.getSessionFunctions()));\n            functions.addAll(functionNamespaceManagers.values().stream()\n                    .filter(x -> x instanceof BuiltInTypeAndFunctionNamespaceManager || catalogsToListFunction.isEmpty() || catalogsToListFunction.contains(x.getCatalogName()))\n                    .flatMap(manager -> manager.listFunctions(likePattern, escape).stream())\n                    .collect(toImmutableList()));\n            functions.addAll(builtInPluginFunctionNamespaceManager.listFunctions(likePattern, escape).stream().collect(toImmutableList()));\n            functions.addAll(builtInWorkerFunctionNamespaceManager.listFunctions(likePattern, escape).stream().collect(toImmutableList()));\n        }\n","sourceCodeStart":542,"sourceCodeEnd":578,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/metadata/FunctionAndTypeManager.java#L542-L578","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n// listing functions for catalog 'foo' that has no function namespace manager\n// after\n// fix etc/catalog/foo.properties so the connector (with function namespace) registers, then retry SHOW FUNCTIONS","handlingStrategy":"validation","validationCode":"if (!functionNamespaceManagers.containsKey(defaultNamespace.getCatalogName())) {\n    throw new IllegalStateException(\"catalog not registered: \" + defaultNamespace.getCatalogName());\n}","typeGuard":"boolean catalogHasFunctionNamespace(String catalog, Map<?,?> managers) { return managers.containsKey(catalog); }","tryCatchPattern":"try { listFunctions(session, like, escape); }\ncatch (PrestoException e) { if (isGenericUserError(e) && e.getMessage().contains(\"Function namespace not found\")) { checkCatalogConfig(catalog); } else throw e; }","preventionTips":["Verify catalog properties files before deploying","Confirm plugin jars land in the plugin directory at startup","Watch startup logs for namespace manager registration errors"],"tags":["presto","function-namespace","catalog-config","generic-user-error"],"backgroundTag":"function-namespace-not-found","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"}