{"record":{"id":"cfc22a6d9c2881f2","repo":"pola-rs/polars","slug":"credential-provider","errorCode":null,"errorMessage":"{credential_provider}","messagePattern":"\\{credential_provider\\}","errorType":"exception","errorClass":null,"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/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/config.py#L1714-L1748","documentation":"Config.set_default_credential_provider accepts either a callable credential provider, a CredentialProviderFunction, or the literal string 'auto'. Any other plain string raises ValueError with the offending string as the message. None resets to default behavior.","triggerScenarios":"pl.Config.set_default_credential_provider('aws'), 'boto3', or any string other than 'auto'.","commonSituations":"Passing a cloud provider name as a string assuming string configuration is supported (as in some other libraries); only 'auto' is a valid string.","solutions":["Pass a callable, e.g. a function matching the CredentialProviderFunction signature.","Pass the string 'auto' to let Polars pick the provider automatically.","Pass None to reset to the default.","Wrap the provider logic in your own function instead of naming it by string."],"exampleFix":"// before\npl.Config.set_default_credential_provider(\"aws\")\n// after\ndef my_provider():\n    return {\"AWS_ACCESS_KEY_ID\": \"...\", ...}\npl.Config.set_default_credential_provider(my_provider)","handlingStrategy":"type-guard","validationCode":"if isinstance(credential_provider, str) and credential_provider != \"auto\":\n    raise ValueError(\"string provider must be 'auto'; pass a callable instead\")\npl.Config.set_default_credential_provider(credential_provider)","typeGuard":"import collections.abc\ndef is_valid_provider(v) -> bool:\n    return v is None or v == \"auto\" or callable(v)","tryCatchPattern":"try:\n    pl.Config.set_default_credential_provider(provider)\nexcept ValueError as e:\n    raise TypeError(\n        f\"{e!r} is not a valid provider; pass a callable or 'auto'\"\n    ) from e","preventionTips":["Remember 'auto' is the only accepted string.","Define provider logic as a function and pass the function object.","Use None to reset to default behavior."],"tags":["python","polars","config","credentials"],"backgroundTag":"invalid-config-value","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"}