{"record":{"id":"98cac3e2e3690a0f","repo":"prestodb/presto","slug":"generic-user-error-98cac3","errorCode":"GENERIC_USER_ERROR","errorMessage":"Catalog %s does not support functions implemented in language %s","messagePattern":"Catalog (.+?) does not support functions implemented in language (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-function-namespace-managers-common/src/main/java/com/facebook/presto/functionNamespace/AbstractSqlInvokedFunctionNamespaceManager.java","lineNumber":293,"sourceCode":"\n    protected void checkCatalog(CatalogSchemaName functionNamespace)\n    {\n        checkArgument(\n                catalogName.equals(functionNamespace.getCatalogName()),\n                \"Catalog [%s] is not served by this FunctionNamespaceManager, expected: %s\",\n                functionNamespace.getCatalogName(),\n                catalogName);\n    }\n\n    protected void refreshFunctionsCache(QualifiedObjectName functionName)\n    {\n        functions.refresh(functionName);\n    }\n\n    protected void checkFunctionLanguageSupported(SqlInvokedFunction function)\n    {\n        if (!sqlFunctionExecutors.getSupportedLanguages().contains(function.getRoutineCharacteristics().getLanguage())) {\n            throw new PrestoException(GENERIC_USER_ERROR, format(\"Catalog %s does not support functions implemented in language %s\", catalogName, function.getRoutineCharacteristics().getLanguage()));\n        }\n    }\n\n    protected FunctionMetadata sqlInvokedFunctionToMetadata(SqlInvokedFunction function)\n    {\n        return new FunctionMetadata(\n                function.getSignature().getName(),\n                function.getSignature().getArgumentTypes(),\n                function.getParameters().stream()\n                        .map(Parameter::getName)\n                        .collect(toImmutableList()),\n                function.getSignature().getReturnType(),\n                function.getSignature().getKind(),\n                function.getRoutineCharacteristics().getLanguage(),\n                getFunctionImplementationType(function),\n                function.isDeterministic(),\n                function.isCalledOnNullInput(),\n                function.getVersion());","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-function-namespace-managers-common/src/main/java/com/facebook/presto/functionNamespace/AbstractSqlInvokedFunctionNamespaceManager.java#L275-L311","documentation":"checkFunctionLanguageSupported rejects a SQL-invoked function whose routine characteristics declare a language the catalog's configured SqlFunctionExecutors cannot execute. This is a GENERIC_USER_ERROR: the caller (CREATE FUNCTION) asked for something unsupported, e.g. declaring language 'PYTHON' on a catalog that only registers 'SQL' executors.","triggerScenarios":"CREATE FUNCTION ... LANGUAGE <x> (or createFunction/replace via the namespace manager) where <x> is not in sqlFunctionExecutors.getSupportedLanguages() for this catalog.","commonSituations":"Typo in the LANGUAGE clause (e.g. 'sql' vs custom language name); migrating functions from a catalog that supports an external language (e.g. python/rpc) to one that does not; plugin providing the language executor not installed on the coordinator.","solutions":["Change the function's LANGUAGE to one listed in the catalog's supported languages (usually 'SQL').","Install/enable the SPI plugin that registers an SqlFunctionExecutor for the desired language on the coordinator.","Verify catalog configuration so the executor supporting the language is bound to this catalog."],"exampleFix":"// before\nCREATE FUNCTION my_ns.fn(x BIGINT) RETURNS BIGINT LANGUAGE PYTHON ...\n// after\nCREATE FUNCTION my_ns.fn(x BIGINT) RETURNS BIGINT LANGUAGE SQL RETURN x + 1","handlingStrategy":"validation","validationCode":"Set<String> supported = sqlFunctionExecutors.getSupportedLanguages();\nif (!supported.contains(function.getRoutineCharacteristics().getLanguage())) {\n    throw new IllegalArgumentException(\"Unsupported language: \" + function.getRoutineCharacteristics().getLanguage());\n}","typeGuard":null,"tryCatchPattern":"try {\n    manager.createFunction(function, replace);\n} catch (PrestoException e) {\n    if (\"Catalog %s does not support functions\".contains(\"language\") || e.getErrorCode() == GENERIC_USER_ERROR.toErrorCode()) {\n        // retry with LANGUAGE SQL\n    }\n}","preventionTips":["Always check the catalog's supported languages before authoring CREATE FUNCTION DDL.","Use LANGUAGE SQL by default unless an executor plugin is installed.","Install the required language-executor plugin on all coordinators.","Keep routine characteristics consistent when migrating functions across catalogs."],"tags":["sql-function","language-unsupported","catalog","user-error"],"backgroundTag":"unsupported-function-language","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"}