lancedb/lancedb · error · NotImplementedError

Function catalog operations are not supported for this…

Error message

Function catalog operations are not supported for this connection type

What it means

create_function_async submits a scalar Python UDF to the remote Function catalog and is remote-only; the base class raises NotImplementedError because local connections have no Function catalog. Its blocking counterpart create_function simply calls this method, so both raise the same error on local connections.

Solutions

  1. Use a remote lancedb connection with the Function catalog if you need registered UDFs.
  2. For local tables, register UDFs directly on the table (e.g. table.add_udf / pandas UDF workflows) instead of the catalog.
  3. Catch NotImplementedError and fall back to table-level UDF registration.
  4. Verify connection type before calling (remote-only API).

Example fix

# before
db.create_function(udf_definition)
# after
try:
    db.create_function(udf_definition)
except NotImplementedError:
    table.add_udf(udf_definition)  # local, per-table UDF registration
Defensive patterns

Strategy: try-catch

Validate before calling

if not hasattr(db, "namespace_client") and type(db).__name__.lower().find("remote") == -1:
    raise RuntimeError("Function catalog requires a remote connection")

Type guard

def function_catalog_supported(db) -> bool:
    fn = getattr(type(db), "create_function_async", None)
    return fn is not None and not getattr(fn, "__isabstractmethod", False)

Try / catch

try:
    db.create_function(definition)
except NotImplementedError:
    table.add_udf(definition)  # local, per-table UDF registration

Prevention

When it happens

Trigger: Calling db.create_function(definition) or db.create_function_async(definition) on a local connection; any use of the UDF Function catalog without a remote backend.

Common situations: Registering UDFs locally expecting catalog persistence (local UDFs are per-table, not cataloged); docs/examples for remote catalogs applied to local DBs.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of lancedb/lancedb@c7b051aff7 (2026-09-08). Data as JSON: /api/errors/9a8d6328e670d404. Report an issue: GitHub.

Appendix: source

Thrown at python/python/lancedb/db.py:710

        """
        raise NotImplementedError("serialize is not supported for this connection type")

    def create_function(self, definition: UdfDefinition) -> FunctionVersion:
        """Register a scalar Python UDF and wait for its immutable version.

        This is the blocking counterpart of :meth:`create_function_async`.
        Local connections raise ``NotImplementedError``.
        """
        return self.create_function_async(definition).wait()

    def create_function_async(self, definition: UdfDefinition) -> Job[FunctionVersion]:
        """Register a scalar Python UDF through the remote Function catalog.

        Submission returns a typed job. The immutable Function version becomes
        available only when :meth:`Job.wait` succeeds. Local connections raise
        ``NotImplementedError``.
        """
        raise NotImplementedError(
            "Function catalog operations are not supported for this connection type"
        )

    def get_function(self, name: str, *, version: str) -> FunctionVersion:
        """Open one exact immutable Function version from the remote catalog."""
        raise NotImplementedError(
            "Function catalog operations are not supported for this connection type"
        )

    def list_functions(self) -> List[FunctionVersion]:
        """List every published immutable Function version.

        Results are ordered by Function name then version. Local connections
        raise ``NotImplementedError``.

        Examples
        --------
        List the identities available to use in Function-backed columns:

View on GitHub (pinned to c7b051aff7)