As per their docstring, DirectoryNamespace.namespace_exists() and DirectoryNamespace.table_exists() are supposed to raise NamespaceNotFoundError / TableNotFoundError when the namespace/table does not exist, however, they return a RuntimeError with message "Failed to downcast NamespaceError source, falling back to runtime error. This may indicate a version mismatch.".
Repro:
import tempfile
from lance.namespace import DirectoryNamespace, NamespaceExistsRequest, TableExistsRequest
ns = DirectoryNamespace(root=tempfile.mkdtemp())
ns.namespace_exists(NamespaceExistsRequest(id=["nonexistent_namespace"]))
# ns.table_exists(TableExistsRequest(id=["nonexistent_table"]))
Result:
[2026-03-20T15:20:33Z WARN lance::error] Failed to downcast NamespaceError source, falling back to runtime error. This may indicate a version mismatch. Source type: "Namespace 'nonexistent_namespace' not found"
Traceback (most recent call last):
File "/home/j/repos/dlt-3546/tmp.py", line 7, in <module>
ns.namespace_exists(NamespaceExistsRequest(id=["nonexistent_namespace"]))
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/j/.cache/uv/archive-v0/HiBtUgMOpG-E8F-FVIxL_/lib/python3.13/site-packages/lance/namespace.py", line 351, in namespace_exists
self._inner.namespace_exists(request.model_dump())
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Namespace error: Namespace 'nonexistent_namespace' not found, /home/runner/work/lance/lance/rust/lance-namespace-impls/src/dir/manifest.rs:1722:17
Using pylance==3.0.1.
As per their docstring,
DirectoryNamespace.namespace_exists()andDirectoryNamespace.table_exists()are supposed to raiseNamespaceNotFoundError/TableNotFoundErrorwhen the namespace/table does not exist, however, they return aRuntimeErrorwith message "Failed to downcast NamespaceError source, falling back to runtime error. This may indicate a version mismatch.".Repro:
Result:
Using
pylance==3.0.1.