pola-rs/polars · error · Exception

did not receive credentials from temporary credentials API f

Error message

did not receive credentials from temporary credentials API for {table_id = }

What it means

Generic Exception from CatalogCredentialProvider (py-polars/src/polars/catalog/unity/client.py:729-743). For Unity Catalog tables whose underlying storage requires temporary credentials, polars calls the catalog's temporary-credentials API with the table_id; if that API answers with empty/absent credentials, the provider yields nothing usable and this error is raised, naming the table_id. It is a server-side/authorization outcome rather than a client bug: the API responded but granted no credentials for that table and operation (read vs write).

Source

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

    def __call__(self) -> CredentialProviderFunctionReturn:  # noqa: D102
        _, (creds, expiry) = self._credentials_iter()
        return creds, expiry

    def _credentials_iter(self) -> Generator[Any]:
        creds, storage_update_options, expiry = self.catalog._get_table_credentials(
            self.table_id, write=self.write
        )

        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 df599052da)

Solutions

  1. Verify the caller has the needed privilege on the table (SELECT for reads, MODIFY/WRITE for writes) in Unity Catalog
  2. Check that the external location / storage credential is enabled for your principal and the table's operation mode
  3. Retry after fixing grants — an intermittent empty response can also come from metastore issues, but treat missing permissions as the primary cause
  4. If credentials are not required (public/credentialed storage), prefer passing storage_options directly
Defensive patterns

Strategy: try-catch

Try / catch

try:
    ldf = catalog.read_table(f'{cat}.{ns}.{tbl}')
except Exception as e:
    msg = str(e)
    if 'did not receive credentials' in msg:
        raise PermissionError(f'no temp credentials for {tbl}: check grants') from e
    raise

Prevention

When it happens

Trigger: catalog.read_table('cat.ns.tbl') or write_table on a table with credential-vending enabled where the API returns no creds: missing SELECT/ALL privileges on the table or its storage credential, wrong credential mode, or an internal/external location not enabled for the calling principal.

Common situations: Service principals without metastore privileges; WRITE privilege missing when write=True (the _get_table_credentials(write=...) path); environment-specific grants that differ between dev and prod; tables backed by external locations the caller cannot access.

Related errors


AI-assisted analysis of pola-rs/polars@df599052da (2026-08-16). Data as JSON: /api/errors/b746b4237139ac63. Report an issue: GitHub.