VictoriaMetrics/VictoriaMetrics · error
cannot read shared credentials for profile %q: %w
Error message
cannot read shared credentials for profile %q: %w
What it means
Fires in getAPICredentials when readSharedCredentials fails for credProfile (either cfg.profile or its resolved source_profile). The wrapped error typically indicates ~/.aws/credentials is missing, unreadable, or has no section for the profile.
Source
Thrown at lib/awsapi/config.go:260
acNew = ac
case len(cfg.profile) > 0:
sourceProfile, profileRoleARN, err := readAWSConfigFile(cfg.profile)
if err != nil {
return nil, fmt.Errorf("cannot read config file for profile %q: %w", cfg.profile, err)
}
credProfile := cfg.profile
if sourceProfile != "" {
if sourceProfile == cfg.profile {
return nil, fmt.Errorf("source_profile for %q points to itself", cfg.profile)
}
credProfile = sourceProfile
}
if roleARN == "" {
roleARN = profileRoleARN
}
ac, err := readSharedCredentials(credProfile)
if err != nil {
return nil, fmt.Errorf("cannot read shared credentials for profile %q: %w", credProfile, err)
}
if ac == nil {
return nil, fmt.Errorf("missing credentials for profile %q", credProfile)
}
acNew = ac
default:
// we need instance credentials if we do not have access keys
ac, err := getInstanceRoleCredentials(cfg.client)
if err != nil {
return nil, fmt.Errorf("cannot obtain instance role credentials: %w", err)
}
acNew = ac
}
// read credentials from sts api, if role_arn is defined
if len(roleARN) > 0 {
ac, err := cfg.getRoleARNCredentials(acNew, roleARN)
if err != nil {
return nil, fmt.Errorf("cannot get credentials for role_arn %q: %w", roleARN, err)View on GitHub (pinned to 5079fb58f1)
Solutions
- Add a [<profile>] section with aws_access_key_id and aws_secret_access_key to the shared credentials file
- Verify AWS_SHARED_CREDENTIALS_FILE points to the correct file
- Check file permissions allow reading by the process user
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/awsapi/config.go:260 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of VictoriaMetrics/VictoriaMetrics@5079fb58f1 (2026-09-03).
Data as JSON: /api/errors/02e4c196eb84e17d.
Report an issue: GitHub.