{"record":{"id":"516b35c79101b480","repo":"pola-rs/polars","slug":"cannot-operation-no-storage-location-found","errorCode":null,"errorMessage":"cannot {operation}: no storage_location found","messagePattern":"cannot (.+?): no storage_location found","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/catalog/unity/client.py","lineNumber":751,"sourceCode":"        yield storage_update_options\n\n        if not creds:\n            table_id = self.table_id\n            msg = (\n                \"did not receive credentials from temporary credentials API for \"\n                f\"{table_id = }\"\n            )\n            raise Exception(msg)  # noqa: TRY002\n\n        yield creds, expiry\n\n\ndef _extract_location_and_data_format(\n    table_info: TableInfo, operation: str\n) -> tuple[str, DataSourceFormat]:\n    if table_info.storage_location is None:\n        msg = f\"cannot {operation}: no storage_location found\"\n        raise ValueError(msg)\n\n    if table_info.data_source_format is None:\n        msg = f\"cannot {operation}: no data_source_format found\"\n        raise ValueError(msg)\n\n    return table_info.storage_location, table_info.data_source_format\n","sourceCodeStart":733,"sourceCodeEnd":758,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/catalog/unity/client.py#L733-L758","documentation":"Raised by the Unity Catalog integration when the table metadata returned by `get_table_info` has a null `storage_location`. Polars needs the physical cloud path (e.g. s3://bucket/...) to actually read or write table data, so `CatalogClient.scan_table` and `write_table` refuse to continue via `_extract_location_and_data_format` (client.py:746). It surfaces as a ValueError with the message 'cannot scan table: no storage_location found'. Most commonly the object exists in the catalog but is not a physical table (a view, or a foreign/share object) or was registered without a location.","triggerScenarios":"Calling `catalog.scan_table(catalog_name, namespace, table_name)` or `catalog.write_table(df, ...)` where the Unity Catalog object is a VIEW (views have no storage location), a Delta Sharing proxy table, a table created with `CREATE VIEW`/external registration without LOCATION, or an API response where the storage_location field is missing/null. Also reproduced when `table_id`/name resolution points at the wrong object type.","commonSituations":"Pointing scan_table at a view name instead of its underlying table; using Databricks Unity Catalog objects shared via Delta Sharing that omit the location; tables created by a metastore migration that registered metadata without a storage path; SDK/API version mismatch where the field is not deserialized.","solutions":["Check the object type: run `SHOW TABLES`/`DESCRIBE TABLE EXTENDED` or `client.get_table_info(...)` and inspect `table_info.table_type` and `table_info.storage_location` before scanning","If it is a view, resolve its definition and scan the underlying base table instead","Re-register/recreate the table with an explicit LOCATION (ALTER TABLE ... SET LOCATION or CREATE TABLE ... LOCATION) if the metadata is genuinely missing it","If using Delta Sharing, fetch the shared table through a supported path rather than the catalog scan API"],"exampleFix":"# before\nlf = catalog.scan_table(\"main\", \"sales\", \"daily_revenue_view\")  # it's a view -> ValueError\n\n# after\ninfo = catalog.get_table_info(\"main\", \"sales\", \"daily_revenue_view\")\nif info.storage_location is None:\n    raise SystemExit(f\"{info.table_type} has no storage; resolve the base table\")\nlf = catalog.scan_table(\"main\", \"sales\", \"daily_revenue_base\")","handlingStrategy":"validation","validationCode":"info = catalog.get_table_info(catalog_name, namespace, table_name)\nif info.storage_location is None:\n    raise ValueError(\n        f\"{catalog_name}.{namespace}.{table_name} ({info.table_type}) has no storage_location\"\n    )","typeGuard":"from polars.catalog.unity.models import TableInfo\n\ndef is_scannable_table(info: TableInfo) -> bool:\n    return info.storage_location is not None and info.table_type not in {\"VIEW\", \"MATERIALIZED_VIEW\"}","tryCatchPattern":"try:\n    lf = catalog.scan_table(cat, ns, tbl)\nexcept ValueError as e:\n    if \"no storage_location found\" in str(e):\n        info = catalog.get_table_info(cat, ns, tbl)\n        raise RuntimeError(f\"{tbl} is a {info.table_type}; scan its base table instead\") from e\n    raise","preventionTips":["Always fetch get_table_info first in catalog wrapper code and assert storage_location/table_type","Treat views as metadata-only: resolve base tables before scan_table calls","Log table_type alongside failures to make catalog-shape issues diagnosable"],"tags":["unity-catalog","cloud-storage","metadata","polars"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}