Skip to content

--profile global flag not applied for auth exec and auth shell commands #1973

Closed

Description

@sgtoj

Describe the Bug

The --profile global flag is not being applied when running atmos auth exec or atmos auth shell, causing "identity not found" errors even when the identity exists in the specified profile. The ATMOS_PROFILE environment variable works correctly as a workaround.

The profile is correctly loaded for other auth subcommands (auth list, auth env, auth whoami), but not for auth exec and auth shell.

Expected Behavior

atmos --profile devops auth exec --identity plat-dev/terraform -- aws sts get-caller-identity

Should authenticate using the plat-dev/terraform identity defined in the devops profile and execute the command successfully.

Steps to Reproduce

  1. Create a profile at .atmos/profiles/devops/atmos.yaml with identities defined
  2. Run atmos --profile devops auth list - identities are shown correctly
  3. Run atmos --profile devops auth exec --identity <identity-name> -- aws sts get-caller-identity
  4. See error: Error: authentication failed: identity not found: <identity-name>

Workaround that works:

ATMOS_PROFILE=devops atmos auth exec --identity plat-dev/terraform -- aws sts get-caller-identity

Screenshots

No response

Environment

  • OS: macOS (darwin/arm64)
  • Atmos Version: 1.203.0

Additional Context

The --profile flag is documented as a global flag and appears in atmos auth exec --help output. The flag works correctly for auth list, auth env, and auth whoami, but fails silently for auth exec and auth shell (the profile simply isn't loaded).

This suggests the profile loading logic may be missing or bypassed in the code paths for auth exec and auth shell commands specifically.

Activity

  1. added
    bug
    on Jan 15, 2026
  2. osterman commented on Jan 15, 2026

    @osterman
    Member

    Brian Ojeda (@sgtoj) are you able to help us validate that #1919 also resolves this issue? This PR refactors auth to use our new flag handler to ensure issues like this don't happen.

    gh pr checkout 1919
    make build
    build/atmos --help
    
  3. added a commit that references this issue on Jan 15, 2026
    5546d2b
  4. sgtoj commented on Jan 15, 2026

    @sgtoj
    SponsorContributorAuthor

    Confirmed 👍

    Image
  5. added a commit that references this issue on May 12, 2026
    823ef2e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions