# Error loading SSO Token: Token for <profile> does not exist

AWS error fixes · Updated 16 November 2026

**Short answer:** The CLI looked in ~/.aws/sso/cache for a sign-in token matching this profile's SSO session or start URL and found none. Run aws sso login with the same profile that failed; if the error persists, the profile points at a different sso-session or start URL from the one you logged in with, or the tool runs as another user or in a container that can't see your cache.

## What the CLI is looking for

When you run `aws sso login`, the CLI saves a token file in `~/.aws/sso/cache/`. The file name is derived from the `sso-session` name (or, for legacy profiles, the `sso_start_url`). Later commands recompute that name from the profile and open the file. If it isn't there you get:

```
Error loading SSO Token: Token for my-org does not exist
```

The name after "Token for" is the sso-session name or start URL the CLI used for the lookup, which is a useful clue: compare it with what you logged in to.

## Causes, most likely first

| Cause | Example |
|---|---|
| Never logged in on this machine or user account | New laptop, fresh container, or the cache was cleared by `aws sso logout` |
| Logged in through a different profile that uses a different session | `dev` uses `[sso-session dev-org]`, `prod` uses `[sso-session my-org]` |
| Legacy profiles whose `sso_start_url` strings differ slightly | One has `https://my-org.awsapps.com/start`, another adds `#/` or a trailing slash, so each hashes to a different file |
| Command runs as a different user | Using `sudo`, a service account, or a CI agent user |
| Docker container without the SSO cache | Only `~/.aws/config` was copied in, not `~/.aws/sso/cache` |

## Fix it

1. **Log in with exactly the profile that failed**:

   ```
   aws sso login --profile prod-admin
   aws sts get-caller-identity --profile prod-admin
   ```

2. **Check the profile's session** if that doesn't stick:

   ```
   aws configure get sso_session --profile prod-admin
   grep -A4 '^\[sso-session' ~/.aws/config
   ```

   Point related profiles at one shared `sso_session` so a single login covers them.

3. **Normalise legacy start URLs**, or better, run `aws configure sso` to move profiles to the sso-session format.

4. **Give containers the whole directory** (read-only is fine, but a refresh then can't be written back):

   ```
   docker run --rm -v "$HOME/.aws:/root/.aws:ro" \
     -e AWS_PROFILE=prod-admin amazon/aws-cli sts get-caller-identity
   ```

5. **Check the cache exists** for your user:

   ```
   ls -la ~/.aws/sso/cache/
   ```

## Related mistakes

- Running `aws sso login` without `--profile` while `AWS_PROFILE` is unset logs in the `default` profile, which may not be an SSO profile at all.
- Deleting `~/.aws/sso/cache` as a fix and then not logging in again. That reliably produces this error.
- Setting `AWS_PROFILE` in one terminal tab and running the command in another. Each shell has its own environment, so the second tab falls back to whatever profile it had.
- If the message instead says the token *has expired and refresh failed*, the cache file exists but is stale; see [that page](https://cloudconsole.dev/errors/sso-token-expired-refresh-failed).

## Questions

### Where does the AWS CLI store SSO tokens?

In ~/.aws/sso/cache as JSON files named from a hash of the sso-session name or start URL. Role credentials obtained with them are cached separately under ~/.aws/cli/cache.

### Why does aws sso login work but other commands say the token does not exist?

You logged in with one profile and are running commands with another that resolves to a different sso-session or start URL. Log in with the failing profile, or make both use the same sso_session.

### Do I need to log in separately for each SSO profile?

Not if they share an sso-session block. One aws sso login for that session covers every profile that references it.

## When this happens away from your desk

This is mainly a local setup problem, but it tends to appear on a fresh machine just when you need access quickly. CloudConsole, a phone app for AWS, is built to let you read alarms and logs on your phone in the meantime.

[About the CloudConsole app](https://cloudconsole.dev/aws-console-app) · [Download on the App Store](https://apps.apple.com/app/cloudconsole-for-aws/id6835419710)

## Sources

- [Configure IAM Identity Center authentication with the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html)

## Related

- [Error when retrieving token from sso: Token has expired and refresh failed](https://cloudconsole.dev/errors/sso-token-expired-refresh-failed)
- [aws sso login](https://cloudconsole.dev/cli/sso-login)
- [aws configure sso](https://cloudconsole.dev/cli/configure-sso)
- [How to log in to AWS SSO from the CLI](https://cloudconsole.dev/how-to/aws-sso-login-cli)
- [The config profile (name) could not be found](https://cloudconsole.dev/errors/config-profile-could-not-be-found)
- [aws configure list-profiles](https://cloudconsole.dev/cli/configure-list-profiles)

---

Source: https://cloudconsole.dev/errors/error-loading-sso-token

CloudConsole is an independent iPhone and Android app for Amazon Web Services by Cloudconcur Ltd. It is not affiliated with Amazon Web Services.
