pola-rs/polars · error · ValueError

cannot : no storage_location found

Error message

cannot {operation}: no storage_location found

What it means

_extract_location_and_data_format validates the Unity Catalog table info before scanning/writing; it raises ValueError when table_info.storage_location is None, i.e. the table metadata has no storage location configured so no path can be derived.

Solutions

  1. Use an external (storage-backed) table with an explicit storage_location
  2. Fetch fresh table info (catalog.get_table(...)) to confirm storage_location is populated
  3. Check the unity-catalog server version supports returning storage_location
  4. Write the table to an explicit location so storage_location is set

Example fix

// before
info = cat.get_table('catalog.schema.managed_tbl')  # storage_location None
pl.scan_delta(info)  # ValueError
// after
info = cat.get_table('catalog.schema.external_tbl')  # has storage_location
pl.scan_delta(info)
Defensive patterns

Strategy: validation

Validate before calling

info = cat.get_table(name)
assert info.storage_location is not None, f'{name} has no storage_location'

Type guard

def is_scannable(info) -> bool:
    return info.storage_location is not None and info.data_source_format is not None

Try / catch

try:
    lf = cat.scan_table(name)
except ValueError as e:
    if 'storage_location' in str(e):
        logging.error('table %s is managed or has no location', name)
    raise

Prevention

When it happens

Trigger: scan_table or write_table on a table whose TableInfo.storage_location is None — typically managed tables (UC manages the location server-side) or tables queried via a name whose metadata omits the field.

Common situations: Pointing the catalog at a UC managed table instead of an external/delta table; stale or partially returned TableInfo from the REST API; using an older unity-catalog server that doesn't populate the field.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/516b35c79101b480. Report an issue: GitHub.

Appendix: source

Thrown at py-polars/src/polars/catalog/unity/client.py:747

        yield storage_update_options

        if not creds:
            table_id = self.table_id
            msg = (
                "did not receive credentials from temporary credentials API for "
                f"{table_id = }"
            )
            raise Exception(msg)  # noqa: TRY002

        yield creds, expiry


def _extract_location_and_data_format(
    table_info: TableInfo, operation: str
) -> tuple[str, DataSourceFormat]:
    if table_info.storage_location is None:
        msg = f"cannot {operation}: no storage_location found"
        raise ValueError(msg)

    if table_info.data_source_format is None:
        msg = f"cannot {operation}: no data_source_format found"
        raise ValueError(msg)

    return table_info.storage_location, table_info.data_source_format

View on GitHub (pinned to fe841f959e)