flyctl Error loading config While parsing config: yaml: invalid trailing UTF-8 octet

All of a sudden, I am getting this error about invalid yaml. It seems to be a flyctl error rather than anything else.

> flyctl 
Error loading config While parsing config: yaml: invalid trailing UTF-8 octet
Error: yaml: invalid trailing UTF-8 octet

> flyctl version update
Error loading config While parsing config: yaml: invalid trailing UTF-8 octet
Error: yaml: invalid trailing UTF-8 octet

> curl -L https://fly.io/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1475    0  1475    0     0   5322      0 --:--:-- --:--:-- --:--:--  5324
######################################################################## 100,0%
Error loading config While parsing config: yaml: invalid trailing UTF-8 octet
Error: yaml: invalid trailing UTF-8 octet

Anyone else seen this?

I resolved by reinstalling flyctl after (re)moving the old files.

> mv .fly .fly-old
> curl -L https://fly.io/install.sh | sh
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

Just popping in on this old thread to say I had this local config corruption just yesterday. The ~/.fly/config.yml file appears to have been overwritten, and it starts off with F�^@'_/�y� i.e. it’s completely unreadable. I add this in case this is helpful for future bug-fixing.

My flyctl always auto-updated, and I would have used the command within the last couple of weeks. The state file indicates that it was version v0.3.224, so I wonder if a bug has been lurking for some years.

I expect the only binary that could have done this was flyctl itself, or the background agent. It looks like it was in the middle of a file locking operation, per some lock files in the ~/.fly folder:

usrnme@usrnme:~/Project$ ls -l ~/.flyold/
total 68
drwx------ 2 usrnme usrnme 4096 Nov 20 23:56 agent-logs
drwxrwxr-x 2 usrnme usrnme 4096 Nov 20 23:56 bin
-rw------- 1 usrnme usrnme 2536 Nov 27 23:01 config.yml
srwxrwxr-x 1 usrnme usrnme    0 Nov 20 23:56 fly-agent.sock
-rw------- 1 usrnme usrnme    0 Nov 25  2024 flyctl.agent.lock
-rw------- 1 usrnme usrnme    0 Nov 25  2024 flyctl.agent.start.lock
-rw------- 1 usrnme usrnme    0 Nov 25  2024 flyctl.cache.lock
-rw------- 1 usrnme usrnme    0 Nov 25  2024 flyctl.config.lock
drwx------ 2 usrnme usrnme 4096 Dec  7 22:10 logs
-rw------- 1 usrnme usrnme  291 Nov 27 15:50 state.yml
drwxrwxr-x 2 usrnme usrnme 4096 Nov 20 23:56 tmp

I appear to have good agent logs up until 2025/11/27, ditto command logs. I can see a good run previously, which puts this in command logs:

DEBUG Loaded flyctl config from/home/usrnme/.fly/config.yml
DEBUG determined hostname: "..."
DEBUG determined working directory: "/home/usrnme/Development/..."
DEBUG determined config directory: "/home/usrnme/.fly"
DEBUG ensured config directory exists.
DEBUG ensured config directory perms.
DEBUG cache loaded.
DEBUG config initialized.
DEBUG skipped querying for new release
DEBUG checking for updates...
DEBUG client initialized.
DEBUG Config has metrics token

DEBUG Starting task manager
DEBUG Task manager done

In a more recent run it stops at “DEBUG cache loaded.”, presumably because it cannot go any further. The machine here is a VirtualBox VM, and it is frequently paused and unpaused; I wonder if that upsets the agent, which is always running.