flyctl "No access token available" error when token is provided

I am working on a scheduled job to run flyctl to adjust our system settings based on a predictable schedule (more detail on this thread) and running into this issue. I created a token on the dashboard for the flyctl client on the server and set it as a secret. For many commands, if I provide the token with the -t flag, I get “Error No access token available. Please login with ‘flyctl auth login’”

Some commands (like flyctl status) work just fine but others like flyctl autoscale show do not).

This works fine:
flyctl status -t $SECRET_TOKEN -a app_name

This (and most other commands I’ve tried) returns “No access token available” error:
flyctl autoscale show -t $SECRET_TOKEN -a app_name

I discovered if I set my environment variable to FLY_ACCESS_TOKEN then the client is able to find my token for all commands, and I do not need to provide a token via -t.

The client seems to ignore the provided token via the -t CLI option in most cases, which appears to be a bug.

Reported this as a bug here: Global -t / --access-token param ignored for many commands · Issue #1506 · superfly/flyctl · GitHub