{"record":{"id":"74ea7cf7bf024b90","repo":"prestodb/presto","slug":"generic-internal-error-74ea7c","errorCode":"GENERIC_INTERNAL_ERROR","errorMessage":"Error getting UserDefinedType: %s","messagePattern":"Error getting UserDefinedType: (.+?)","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":188,"sourceCode":"        return fetchFunctionsDirect(functionName);\n    }\n\n    @Override\n    public Optional<UserDefinedType> getUserDefinedType(QualifiedObjectName typeName)\n    {\n        try {\n            return Optional.of(userDefinedTypes.getUnchecked(typeName));\n        }\n        catch (UncheckedExecutionException e) {\n            Throwable cause = e.getCause();\n            if (cause instanceof PrestoException) {\n                PrestoException prestoException = (PrestoException) cause;\n                if (prestoException.getErrorCode().equals(NOT_FOUND.toErrorCode())) {\n                    return Optional.empty();\n                }\n                throw prestoException;\n            }\n            throw new PrestoException(GENERIC_INTERNAL_ERROR, format(\"Error getting UserDefinedType: %s\", typeName), cause);\n        }\n    }\n\n    @Override\n    public FunctionHandle getFunctionHandle(Optional<? extends FunctionNamespaceTransactionHandle> transactionHandle, Signature signature)\n    {\n        checkCatalog(signature.getName());\n        // This is the only assumption in this class that we're dealing with sql-invoked regular function.\n        SqlFunctionId functionId = new SqlFunctionId(signature.getName(), signature.getArgumentTypes());\n        if (transactionHandle.isPresent()) {\n            return transactions.get(transactionHandle.get()).getFunctionHandle(functionId);\n        }\n        FunctionCollection collection = new FunctionCollection();\n        collection.loadAndGetFunctionsTransactional(signature.getName());\n        return collection.getFunctionHandle(functionId);\n    }\n\n    @Override","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-function-namespace-managers-common/src/main/java/com/facebook/presto/functionNamespace/AbstractSqlInvokedFunctionNamespaceManager.java#L170-L206","documentation":"AbstractSqlInvokedFunctionNamespaceManager.getUserDefinedType wraps any non-NOT_FOUND exception thrown by the underlying UDT fetch into a GENERIC_INTERNAL_ERROR PrestoException. It is a server-side wrapper meaning 'the catalog asked for a user-defined type and something went wrong that was not simply type-not-found'. The original cause is attached, so the root reason is in the cause chain.","triggerScenarios":"Calling getUserDefinedType(typeName) on a SQL-invoked function namespace manager when the backing delegate throws any exception other than NOT_FOUND (e.g. connection failure, permission denial, serialization error while resolving the UDT).","commonSituations":"Remote function-namespace store outage or misconfigured endpoint; the delegate raising an unexpected exception (auth failure, schema corruption); querying a UDT whose registration is partially written or incompatible after a version upgrade.","solutions":["Inspect the attached cause of the PrestoException to find the real failure (network, auth, decode) and fix that root issue.","Verify the function namespace manager is configured and reachable (endpoint, credentials).","Confirm the UDT exists and is fully registered; retry after the backing store is healthy.","Check for version skew between coordinator and namespace manager that could break UDT deserialization."],"exampleFix":"// before\nType udt = namespaceManager.getUserDefinedType(typeName);\n// after\ntry {\n    Type udt = namespaceManager.getUserDefinedType(typeName);\n} catch (PrestoException e) {\n    if (e.getCause() != null) {\n        log.error(\"UDT lookup failed for %s\", e.getCause());\n    }\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"// Pre-check that the UDT is registered by listing known types, if the manager exposes them\nboolean known = namespaceManager.listUserDefinedTypes().stream()\n        .anyMatch(t -> t.equals(typeName));","typeGuard":"boolean isResolvableUdt(String typeName) {\n    try {\n        namespaceManager.getUserDefinedType(typeName);\n        return true;\n    } catch (PrestoException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    Type type = namespaceManager.getUserDefinedType(typeName);\n} catch (PrestoException e) {\n    Throwable root = e.getCause();\n    // fall back to base type handling or fail with the root cause surfaced\n}","preventionTips":["Keep the function namespace store reachable and monitored.","Register UDTs atomically so partially-written types are never queried.","Always inspect getCause() when wrapping server exceptions.","Pin matching versions between coordinator and namespace manager plugins."],"tags":["udt","function-namespace","internal-error","catalog"],"backgroundTag":"udt-lookup-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"}