{"record":{"id":"690d95be3e5afbbe","repo":"pola-rs/polars","slug":"cannot-load-requested-aws-profile-self-profile-name-type-e","errorCode":null,"errorMessage":"cannot load requested aws_profile '{self.profile_name}': {type(e).__name__}: {e}","messagePattern":"cannot load requested aws_profile '(.+?)': (.+?): (.+?)","errorType":"exception","errorClass":"ComputeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/cloud/credential_provider/_providers.py","lineNumber":285,"sourceCode":"        if self._auto_init_unhandled_key:\n            if verbose():\n                eprint(\n                    \"[CredentialProviderAWS]: Will not be used as a provider: \"\n                    f\"unhandled key in storage_options: '{self._auto_init_unhandled_key}'\"\n                )\n\n            return False\n\n        try:\n            self()\n\n        except ImportError as e:\n            if self.profile_name:\n                msg = (\n                    \"cannot load requested aws_profile \"\n                    f\"'{self.profile_name}': {type(e).__name__}: {e}\"\n                )\n                raise polars.exceptions.ComputeError(msg) from e\n\n            return False\n\n        except self.EmptyCredentialError:\n            if verbose():\n                eprint(\"[CredentialProviderAWS]: Did not find any credentials\")\n\n            return False\n\n        return True\n\n    def _session(self) -> boto3.Session:\n        # Note: boto3 automatically sources the AWS_PROFILE env var\n        import boto3\n\n        return boto3.Session(\n            profile_name=self.profile_name,\n            region_name=self.region_name,","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/cloud/credential_provider/_providers.py#L267-L303","documentation":"When the AWS credential provider cannot import boto3 and an explicit aws_profile was requested, polars wraps the ImportError in a ComputeError naming the profile, because the requested profile simply cannot be loaded without the AWS SDK.","triggerScenarios":"Passing credential_provider='aws' (or storage_options with aws_profile='<name>') while boto3/botocore is not installed, so profile loading fails at import time.","commonSituations":"Deployments that installed polars without the AWS extra; docker images stripped of boto3; specifying a profile in config but forgetting the SDK dependency in the new environment.","solutions":["pip install boto3 (and botocore) in the environment.","Install polars with the relevant extra, e.g. pip install 'polars[aws]'.","If no profile is actually needed, drop aws_profile so the provider can fall back gracefully."],"exampleFix":"// before\n lf = pl.scan_parquet(\"s3://b/f\", credential_provider=\"aws_profile:prod\")\n// after\n # pip install boto3\n lf = pl.scan_parquet(\"s3://b/f\", credential_provider=\"aws_profile:prod\")","handlingStrategy":"try-catch","validationCode":"import importlib.util\nif use_aws_profile and importlib.util.find_spec('boto3') is None:\n    raise RuntimeError('boto3 required for aws_profile credential provider')","typeGuard":"def boto3_available() -> bool:\n    return importlib.util.find_spec('boto3') is not None","tryCatchPattern":"try:\n    provider = pl.CredentialProviderAWS(profile_name='prod')\nexcept polars.exceptions.ComputeError as e:\n    if 'cannot load requested aws_profile' in str(e):\n        provider = None  # fall back to env-var credentials\n    else:\n        raise","preventionTips":["Add boto3 to install requirements wherever aws_profile auth is configured.","Smoke-test profile loading at service startup, not on first query.","Keep dependency extras ('polars[aws]') in sync with configured credential providers."],"tags":["python","aws","boto3","missing-dependency"],"backgroundTag":"missing-optional-dependency","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"}