{"record":{"id":"cfc22a6d9c2881f2","repo":"pola-rs/polars","slug":"credential-provider","errorCode":null,"errorMessage":"{credential_provider}","messagePattern":"\\{credential_provider\\}","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/config.py","lineNumber":1732,"sourceCode":"        credential_provider\n            Provide a function that can be called to provide cloud storage\n            credentials. The function is expected to return a dictionary of\n            credential keys along with an optional credential expiry time.\n\n            Can also be set to None, which globally disables auto-initialization\n            of credential providers, or \"auto\" (the default behavior).\n\n        Examples\n        --------\n        >>> pl.Config.set_default_credential_provider(\n        ...     pl.CredentialProviderAWS(\n        ...         assume_role={\"RoleArn\": \"...\", \"RoleSessionName\": \"...\"}\n        ...     )\n        ... )\n        <class 'polars.config.Config'>\n        \"\"\"\n        if isinstance(credential_provider, str) and credential_provider != \"auto\":\n            raise ValueError(credential_provider)\n\n        _set_default_credential_provider(credential_provider)\n\n        return cls\n\n    @classmethod\n    def reload_env_vars(cls) -> None:\n        \"\"\"\n        Update the Polars config from the set environment variables.\n\n        Normally you need not call this, it is only necessary when updating\n        undocumented (environment-variable-only) config flags from Python after\n        importing Polars.\n        \"\"\"\n        plr.config_reload_env_vars()\n","sourceCodeStart":1714,"sourceCodeEnd":1748,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/py-polars/src/polars/config.py#L1714-L1748","documentation":"`pl.Config.set_default_credential_provider(provider)` only accepts the string 'auto' (reset to automatic detection) or an actual credential provider object such as `pl.CredentialProviderAWS(...)`. Any other string raises ValueError whose message is just the offending string itself — an unusual pattern, so the traceback looks odd but simply means 'invalid credential provider name'.","triggerScenarios":"`pl.Config.set_default_credential_provider('aws')` or 'auto_detect' — passing a provider name where an object is required; loading provider choice from a config file as a string.","commonSituations":"Assuming providers are selectable by name string; migrating code that stored provider names; mixing up this global default with the per-call credential_provider argument of scan/read functions.","solutions":["Pass an instance: `pl.Config.set_default_credential_provider(pl.CredentialProviderAWS(assume_role={...}))`.","Pass 'auto' to restore automatic credential resolution, or None to clear the override.","Keep provider selection in Python code rather than serializing provider names to config files."],"exampleFix":"# before\npl.Config.set_default_credential_provider(\"aws\")  # ValueError: aws\n\n# after\npl.Config.set_default_credential_provider(\n    pl.CredentialProviderAWS(assume_role={\"RoleArn\": \"...\", \"RoleSessionName\": \"...\"})\n)","handlingStrategy":"validation","validationCode":"def set_credential_provider(provider: object) -> None:\n    if isinstance(provider, str) and provider != \"auto\":\n        raise ValueError(\n            f\"credential provider must be an instance or 'auto', got name {provider!r}; \"\n            \"e.g. pl.CredentialProviderAWS(...)\"\n        )\n    pl.Config.set_default_credential_provider(provider)","typeGuard":"def is_valid_credential_provider(provider: object) -> bool:\n    return not isinstance(provider, str) or provider == \"auto\"","tryCatchPattern":null,"preventionTips":["Never serialize credential provider names to config; construct provider objects in code.","Remember the ValueError message is just the bad string itself — log the provider argument for context."],"tags":["config","credentials","cloud-storage","validation","polars"],"backgroundTag":"invalid-credential-provider","analyzedSha":"68506541d2de983056c9eb244e1ea05fab377dfc","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}