lancedb/lancedb · error · ValueError

lance.blob.v2 is already registered by another extension…

Error message

lance.blob.v2 is already registered by another extension class

What it means

As a fallback, lancedb registers its own _FallbackBlobType under the 'lance.blob.v2' Arrow extension name. If PyArrow rejects the registration because the name is already taken (pa.ArrowKeyError), this ValueError is raised. Like error 403, it means another class already owns the lance.blob.v2 extension name in this process.

Solutions

  1. Remove duplicate lance installs: pip uninstall -y lance lancedb && pip install -U lancedb lance.
  2. Grep dependencies for "lance.blob.v2" / register_extension_type and eliminate the competing registration.
  3. Clean up extension registrations in tests (pa.unregister_extension_type) between test runs.
  4. Import lancedb first in the process so its blob type wins the registration.

Example fix

# before
custom_ext.py: pa.register_extension_type(MyBlobType())  # uses 'lance.blob.v2'
# after
MyBlobType.__arrow_ext_class__ ... use a unique name e.g. 'myapp.blob.v1'
Defensive patterns

Strategy: fallback

Validate before calling

import pyarrow as pa
exts = getattr(pa, "extension_types", lambda: {})()
if "lance.blob.v2" in exts:
    print("lance.blob.v2 already registered by", exts["lance.blob.v2"])

Try / catch

try:
    from lancedb.schema import BlobType
except ValueError as err:
    # 'already registered by another extension class'
    # fix env, then retry
    raise

Prevention

When it happens

Trigger: Something registered a PyArrow extension type with field name 'lance.blob.v2' before lancedb lazily resolves its blob type — e.g. another lance version's module, or a custom extension using the same name; first access to lancedb.schema.BlobType or a blob column then fails.

Common situations: Duplicate/stale lance installations; importing two forked/vendored blob implementations; running multiple incompatibly versioned LanceDB components in one interpreter; test suites that register extension types globally without cleanup.

Related errors


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

Appendix: source

Thrown at python/python/lancedb/schema.py:177

    except ModuleNotFoundError as err:
        if err.name not in ("lance", "lance.blob"):
            raise
    else:
        blob_type = getattr(blob_module, "BlobType", None)
        if blob_type is not None:
            registered_type = _deserialize_registered_type(blob_type())
            if type(registered_type) is not blob_type:
                registered_cls = type(registered_type)
                raise ValueError(
                    "lance.blob.v2 is already registered by "
                    f"{registered_cls.__module__}.{registered_cls.__qualname__}"
                )
            _resolved_blob_type = blob_type
            return blob_type
    try:
        pa.register_extension_type(_FallbackBlobType())  # type: ignore[arg-type]
    except pa.ArrowKeyError as err:
        raise ValueError(
            "lance.blob.v2 is already registered by another extension class"
        ) from err
    _resolved_blob_type = _FallbackBlobType
    return _resolved_blob_type


def blob(name: str, nullable: bool = True) -> pa.Field:
    """Create a Lance blob v2 column field.

    When pylance is installed this is ``lance.blob.BlobType``.
    """
    blob_type = _resolve_blob_type()
    return pa.field(name, blob_type(), nullable=nullable)


def vector(dimension: int, value_type: pa.DataType = pa.float32()) -> pa.DataType:
    """A help function to create a vector type.

View on GitHub (pinned to c7b051aff7)