CloudConsole

The config profile (name) could not be found

Updated 16 November 2026 · How we write and check guides

Short answer

The CLI was told to use a named profile, through --profile or the AWS_PROFILE variable, and no section with that name exists in the config or credentials files it read. Most often AWS_PROFILE still points to a profile you renamed or deleted, or the section header is written the wrong way for its file: [profile prod] in ~/.aws/config, but plain [prod] in ~/.aws/credentials.

Causes, most likely first, in 5 steps: 1. A stale AWS_PROFILE; 2. Wrong header style; 3. A different config file is being…
The diagnosis and fix steps from this page, in the order to try them; commands and details are below.

What the CLI is looking for

$ aws sso login
The config profile (prod) could not be found

The name in brackets is the profile the CLI tried to load. It searches two files, and their header syntax differs:

FileNamed profile headerDefault profile
~/.aws/config[profile prod][default]
~/.aws/credentials[prod][default]

A section named [prod] in config, or [profile prod] in credentials, is not recognised as profile prod. Names are also case-sensitive: Prod and prod are different profiles.

Causes, most likely first

  1. A stale AWS_PROFILE. It's set in a shell profile, a .envrc or a CI variable and names a profile that no longer exists. Because it applies to every command, even aws configure list fails, which makes it look like the CLI is broken.
  2. Wrong header style, as in the table above. Common after hand-copying a snippet meant for the other file.
  3. A different config file is being read: AWS_CONFIG_FILE or AWS_SHARED_CREDENTIALS_FILE points elsewhere, or you're running as another user (sudo, a CI agent, a container) with its own home directory.
  4. A typo or case mismatch between the command and the file.
  5. The profile was never created on this machine. SSO profiles made with aws configure sso on your laptop don't exist on a build server or a teammate's machine.

Fix it

  1. See what the CLI thinks is selected and what exists:
    echo "AWS_PROFILE=$AWS_PROFILE AWS_CONFIG_FILE=$AWS_CONFIG_FILE"
    unset AWS_PROFILE
    aws configure list-profiles
  2. If the profile isn't listed, look at the raw headers:
    grep -n '^\[' ~/.aws/config ~/.aws/credentials
    Correct the header style, or create the profile properly:
    aws configure sso --profile prod      # IAM Identity Center
    aws configure --profile prod          # access keys
  3. Run the command again with the profile named explicitly:
    aws sso login --profile prod
    aws sts get-caller-identity --profile prod
  4. Remove the stale export AWS_PROFILE=… from ~/.bashrc, ~/.zshrc or your CI settings if that was the cause.

Tools beyond the CLI

SDKs and tools such as Terraform read the same files and the same variable, so a bad AWS_PROFILE breaks them all; the Python SDK reports it as ProfileNotFound. In Docker, mount the whole ~/.aws directory to the container user's home (often /root/.aws) and pass -e AWS_PROFILE=prod. In VS Code dev containers and similar setups, check which user the terminal runs as before assuming the mount is correct.

Questions

Why does aws sso login say the config profile could not be found?

aws sso login uses AWS_PROFILE or the default profile when you don't pass --profile. If AWS_PROFILE names a profile that doesn't exist, or the SSO profile header isn't [profile name], it fails with this error.

How do I list my AWS CLI profiles?

Run aws configure list-profiles. It prints every profile found in both the config and credentials files.

Should I put profiles in config or credentials?

Settings such as region, SSO and role_arn belong in ~/.aws/config under [profile name]. Long-term access keys go in ~/.aws/credentials under [name]. Either file can define a profile, but the header styles differ.

CloudConsole home screen showing what needs attention on a phone, for following up on The config profile (name) could not…
When this happens away from your desk

A profile mix-up usually just costs you a few minutes, but during an incident those minutes count. CloudConsole, a phone app for AWS, is built to keep alarms and logs readable on your phone while you get your terminal back in order.

Did it start after a deploy? What changed? on the app’s alarm screen lists the deploys and configuration changes from the hour before the alarm fired.

About the app → · Download on the App Store

Sources