{"record":{"id":"b746b4237139ac63","repo":"pola-rs/polars","slug":"did-not-receive-credentials-from-temporary-credentials-api","errorCode":null,"errorMessage":"did not receive credentials from temporary credentials API for {table_id = }","messagePattern":"did not receive credentials from temporary credentials API for (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/catalog/unity/client.py","lineNumber":737,"sourceCode":"\n    def __call__(self) -> CredentialProviderFunctionReturn:  # noqa: D102\n        _, (creds, expiry) = self._credentials_iter()\n        return creds, expiry\n\n    def _credentials_iter(self) -> Generator[Any]:\n        creds, storage_update_options, expiry = self.catalog._get_table_credentials(\n            self.table_id, write=self.write\n        )\n\n        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":719,"sourceCodeEnd":754,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/catalog/unity/client.py#L719-L754","documentation":"Raised when Unity Catalog's temporary credentials API returns an empty/missing credential set for a table. The catalog client requires short-lived storage credentials to access table data and treats an empty response as fatal.","triggerScenarios":"Calling CatalogOperations.__call__/scan_table/write_table where the UC `get temporary table credentials` REST call returns no `aws_temp_credentials` (or equivalent) in its response, e.g. missing vended-credentials entitlement.","commonSituations":"Service principal lacks EXTERNAL_USE_STORAGE_CREDENTIALS privilege; UC workspace not configured for credential vending; external location misconfigured; using a token without storage access.","solutions":["Verify the caller has EXTERNAL_USE_STORAGE_CREDENTIALS (or appropriate) privilege on the external location/table","Check the external location in Unity Catalog is properly configured with cloud storage credentials","Retry with an authenticated token/service principal that supports credential vending","As a workaround, provide storage credentials directly to the IO engine if supported"],"exampleFix":"// before\npl.scan_delta('delta://uc_catalog.schema.table')  # fails: no vended creds\n// after\n# grant: GRANT EXTERNAL USE STORAGE ON EXTERNAL LOCATION loc TO `principal`;\npl.scan_delta('delta://uc_catalog.schema.table')  # succeeds once vending works","handlingStrategy":"try-catch","validationCode":"info = cat.get_table(table_id)\nif info.storage_location is None:\n    raise RuntimeError('table has no external storage location; credential vending cannot apply')","typeGuard":"def has_vended_creds(resp: dict) -> bool:\n    return bool(resp.get('aws_temp_credentials') or resp.get('credentials'))","tryCatchPattern":"try:\n    lf = pl.scan_delta(f'delta://{catalog}.{schema}.{table}')\nexcept Exception as e:\n    if 'temporary credentials' in str(e):\n        # fall back to direct storage access or re-authenticate\n        ...\n    raise","preventionTips":["Grant EXTERNAL_USE_STORAGE_CREDENTIALS to the accessing principal","Confirm the external location has working cloud credentials","Test credential vending with a direct REST call before use","Use a service principal rather than personal tokens in automation"],"tags":["unity-catalog","credentials","network"],"backgroundTag":"missing-credentials","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}