{"record":{"id":"449354d5985c1cc9","repo":"prestodb/presto","slug":"function-not-found-449354","errorCode":"FUNCTION_NOT_FOUND","errorMessage":"FUNCTION_NOT_FOUND semantic error with cause message","messagePattern":"FUNCTION_NOT_FOUND semantic error with cause message","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/ExpressionAnalyzer.java","lineNumber":1967,"sourceCode":"    }\n\n    public static FunctionHandle resolveFunction(\n            Optional<Map<SqlFunctionId, SqlInvokedFunction>> sessionFunctions,\n            Optional<TransactionId> transactionId,\n            FunctionCall node,\n            List<TypeSignatureProvider> argumentTypes,\n            FunctionAndTypeResolver functionAndTypeResolver)\n    {\n        try {\n            return functionAndTypeResolver.resolveFunction(\n                    sessionFunctions,\n                    transactionId,\n                    functionAndTypeResolver.qualifyObjectName(node.getName()),\n                    argumentTypes);\n        }\n        catch (PrestoException e) {\n            if (e.getErrorCode().getCode() == StandardErrorCode.FUNCTION_NOT_FOUND.toErrorCode().getCode()) {\n                throw new SemanticException(SemanticErrorCode.FUNCTION_NOT_FOUND, node, e.getMessage());\n            }\n            if (e.getErrorCode().getCode() == StandardErrorCode.AMBIGUOUS_FUNCTION_CALL.toErrorCode().getCode()) {\n                throw new SemanticException(SemanticErrorCode.AMBIGUOUS_FUNCTION_CALL, node, e.getMessage());\n            }\n            throw e;\n        }\n    }\n\n    public static Map<NodeRef<Expression>, Type> getExpressionTypes(\n            Session session,\n            Metadata metadata,\n            SqlParser sqlParser,\n            TypeProvider types,\n            Expression expression,\n            Map<NodeRef<Parameter>, Expression> parameters,\n            WarningCollector warningCollector)\n    {\n        return getExpressionTypes(session, metadata, sqlParser, types, expression, parameters, warningCollector, false);","sourceCodeStart":1949,"sourceCodeEnd":1985,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/ExpressionAnalyzer.java#L1949-L1985","documentation":"During function resolution, ExpressionAnalyzer calls the function registry with qualified name and argument types. If the registry throws PrestoException with FUNCTION_NOT_FOUND (no signature matches), it is rethrown as a SemanticException FUNCTION_NOT_FOUND bound to the expression node, carrying the cause's message (e.g. 'Function not found: foo(varchar)').","triggerScenarios":"Calling an unqualified/misspelled function name, or a function whose argument types match no registered signature, when the SQL statement is analyzed.","commonSituations":"Typos in function names, using a function from a plugin not installed, wrong argument types for overloaded functions, session/catalog where the function does not exist.","solutions":["Fix the function name spelling/qualification in the query per the message's resolved signature","Adjust argument types (add explicit CASTs) so they match an existing overload","Install/enable the plugin providing the function, or switch to an available equivalent"],"exampleFix":"// before\nSELECT array_distinct_agg(col) FROM t -- function not registered\n// after\nSELECT array_agg(DISTINCT col) FROM t -- use built-in equivalent","handlingStrategy":"try-catch","validationCode":"// Pre-check function availability via system metadata\nSELECT function_name FROM system.metadata.functions WHERE function_name = 'myfunc';","typeGuard":null,"tryCatchPattern":"try {\n    return session.execute(sql);\n} catch (SemanticException e) {\n    if (e.getCode() == SemanticErrorCode.FUNCTION_NOT_FOUND) {\n        throw new IllegalStateException(\"Function missing or mistyped: \" + e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Verify function names against SHOW FUNCTIONS for the target catalog","Match argument types to a registered overload; CAST where needed","Install required plugins/UDFs before deploying queries"],"tags":["function-not-found","function-resolution","presto"],"backgroundTag":"function-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"}