Skip to content

Intermittent “An error occurred while loading credentials” after AssumeRole (Rust SDK) #1381

@erenyigit-arf

Description

@erenyigit-arf

Describe the bug

We are intermittently receiving the following error when using the AWS SDK for Rust to assume an IAM role:
An error occurred while loading credentials

The issue is not consistent — sometimes the AssumeRole call succeeds and credentials load correctly, but other times the same code fails with the above message. No additional logs or stack traces are printed.

Sample Code:

let provider = AssumeRoleProvider::builder(arn)
    .region(Region::new(region.to_owned()))
    .session_name("zaphod")
    .build()
    .await;

let credentials = provider.provide_credentials().await?;

Environment:

  • SDK: AWS SDK for Rust:
  • aws-config = { version = "1.8.8", features = [ "behavior-version-latest" ], optional = true }
  • aws-credential-types = { version = "1.2.8", optional = true }
  • aws-sdk-secretsmanager = { version = "1.90.0", optional = true }
  • aws-sdk-kms = { version = "1.90.0", optional = true }
  • aws-sdk-sts = { version = "1.88.0", optional = true }
  • OS: EC2 Ubuntu 24.04
  • Region: eu-central-2
  • Context: EC2, STS, Secret Manager

Expected:
AssumeRole should consistently return valid temporary credentials.

Actual:
The operation sometimes fails with “An error occurred while loading credentials,” without any further diagnostic output.

Request:
Any idea for credential loading failures in the Rust SDK?
Are there known issues or recommended retries/logging options for the AssumeRoleProvider?

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

AssumeRole should consistently return valid temporary credentials.

Current Behavior

Assume role operation sometimes fails with “An error occurred while loading credentials,” without any further diagnostic output.

Reproduction Steps

We are intermittently receiving the following error when using the AWS SDK for Rust to assume an IAM role:
An error occurred while loading credentials

  • SDK: AWS SDK for Rust:
  • aws-config = { version = "1.8.8", features = [ "behavior-version-latest" ], optional = true }
  • aws-credential-types = { version = "1.2.8", optional = true }
  • aws-sdk-secretsmanager = { version = "1.90.0", optional = true }
  • aws-sdk-kms = { version = "1.90.0", optional = true }
  • aws-sdk-sts = { version = "1.88.0", optional = true }
  • OS: EC2 Ubuntu 24.04
  • Region: eu-central-2
  • Context: EC2, STS, Secret Manager

Possible Solution

No response

Additional Information/Context

No response

Version

- SDK: AWS SDK for Rust:
- aws-config = { version = "1.8.8", features = [ "behavior-version-latest" ], optional = true }
- aws-credential-types = { version = "1.2.8", optional = true }
- aws-sdk-secretsmanager = { version = "1.90.0", optional = true }
- aws-sdk-kms = { version = "1.90.0", optional = true }
- aws-sdk-sts = { version = "1.88.0", optional = true }
- OS: EC2 Ubuntu 24.04
- Region: eu-central-2
- Context: EC2, STS, Secret Manager

Environment details (OS name and version, etc.)

  • OS: EC2 Ubuntu 24.04

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.closed-for-stalenessp2This is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to 'closing-soon' in 7 days.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions