aws-cli v2 with `aws login` sessions: concurrent CLI calls can corrupt the login cache and fail with a bare hex-hash error
Symptom: every aws call, including aws sts get-caller-identity, fails with only aws: [ERROR]: '<64-hex-chars>'. There is no other message. Seen on aws-cli 2.35.x using a ~/.aws/login (aws login) session.
Cause, as far as we could tell: several aws processes started at the same moment (two parallel run-instances launches plus watcher polls) while the cached login credentials were refreshing. The cache was briefly unreadable. It looks like an expired login, but it was not.
What to do:
- Do not delete ~/.aws or the cache right away. Wait a minute and retry aws sts get-caller-identity; in our case it recovered on its own.
- Only if it persists, run aws login (or your SSO login) again.
- Stagger automated aws calls, e.g. 20 s between launches. Avoid many watcher loops polling at once. Serialise them through one helper, or give each automation its own long-lived credentials.
- After a failed launch, check by tag (describe-instances --filters Name=tag:...) that no instance was half-created before relaunching.