Flyctl agent wont start

I run flyctl postgres db list <name of db> and I get Error can't establish agent: agent: failed to start. I then run flyctl doctor and I get:

Testing authentication token... PASSED
Testing flyctl agent... FAILED
(Error: couldn't ping agent: agent not running)

Can't communicate with flyctl's background agent.

Run 'flyctl agent restart'.

So I run flyctl agent restart and now I get

Error failed establishing connection to agent: agent: failed to start

The agent failed to start with the following error log:

2022/06/02 09:19:24.450633 srv another instance of the agent is already running

When I run ps aux | grep "flyctl agent", nothing returns though.

This is debilitating because it stops me from running anything else.

There should be some logs in ~/.fly/agent-logs/. Find the one with the latest timestamp and check its contents. There may be a hint as to what’s causing the problem. Did this just start happening suddenly? Also, which version of flyctl?

It happened when I tried to do postgres attach. I did a bunch of stuff and then (mysteriously) there was an agent that I could kill, so I killed it and now can run everything again. Honestly have no idea how to describe this bug report.