Bk-agent stop fails with auth error

Hi there BK folks.

We have been running our buildkite agents for some time now.
We happen to run them in docker containers, and we have implemented scale up/down.
We are running very recent BK agent 3.95.1

I’m trying to improve the behavior of our agent fleet on scale down.
The agent stop command docs seems like just what we want.

We are transitioning from unclustered to clustered agents. In this particular case, the behavior I’m seeing is in our unclustered agent pool. It might we be happening as well in our clustered agent pool; not sure.

Using the same configuration that started buildkite-agent, I get a 401 Auth error, eg:

$ sudo buildkite-agent stop --agent-access-token REDACTED
  ...
buildkite-agent: fatal: failed to stop agent: POST https://agent.buildkite.com/v3/stop: 401 Unauthorized: Invalid access token

this happens whether I pass the token on the command line or read it from the config file (as bk-agent start does).

I’ve tried passing --debug and --debug-http, which don’t seem to provide much of a hint here.

We would prefer to take advantage of the stop semantics of gracefully shutting down, but so far have not been successful. Any pointers appreciated.

Hey @jeffmcc-persona :wave:

Welcome to the Buildkite community!

Would you able to send the build link to support@buildkite.com so we can continue further investigation?

Cheers,
Priya