digitalocean / digitalocean/doctl

v1.158.0 cannot parse config files it writes — "yaml: line 2228: did not find expected key"

Open
#1,842 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
3.4k
Forks
496
Avg merge
1d 2h
Merged PRs (30d)
31

Description

## Summary

doctl `v1.158.0` (released 2026-05-07 16:21 UTC) cannot read its own config files. Every doctl invocation fails at startup with:

```
doctl: 2026/05/07 21:08:20 Config initialization failed: While parsing config: yaml: line 2228: did not find expected key
```

`v1.157.0` reads the **same file** successfully — verified.

## Reproduction

1. Install doctl v1.158.0
2. Run any doctl command (auth init, auth list, registry login, etc.)
3. The first invocation may write a default config (37,883 bytes / 2,227 lines on Linux x86_64); subsequent invocations fail to read it.

The error appears at line 2228 of a 2227-line file — i.e., doctl's parser expects more YAML content than the writer produced. The file ends mid-section with `vpcs.update.name: ""`.

## Evidence the file itself is valid YAML

`yaml.safe_load` (PyYAML) parses the file successfully:
- 91 top-level keys
- Well-formed structure (1-click, access-token, account, action, activations, agent, alert, api-url, apikeys, apps, ...)

So the failure is in doctl's parser, not the file.

## Evidence v1.157.0 reads the same file

```bash
$ wget https://github.com/digitalocean/doctl/releases/download/v1.157.0/doctl-1.157.0-linux-amd64.tar.gz
$ tar xf doctl-1.157.0-linux-amd64.tar.gz
$ ./doctl --config=/home/USER/.config/doctl/config.yaml auth list
default (current) # <-- success on the same file v1.158.0 fails on
```

## Suspected commit

The v1.157.0 → v1.158.0 changelog has only 2 commits:

- [#1835 DOKS SSO: per-cluster config, kubeconfig type](https://github.com/digitalocean/doctl/pull/1835) — explicitly modifies config schema structure
- [#1839 Bump godo to v1.189.0](https://github.com/digitalocean/doctl/pull/1839) — internal HTTP client only, unlikely cause

#1835 is the prime suspect — config schema additions can produce serialization output that the parser doesn't expect.

## Impact

- All CI runs using `digitalocean/action-doctl@v2` (which defaults to `version: 'latest'`) broke today within hours of the v1.158.0 release.
- Workaround: pin to `version: '1.157.0'` in workflow input.
- Long-term users with shared doctl config homes (e.g., self-hosted runners) are affected even after pinning, since the broken file persists until manually cleared. v1.157.0 reads the v1.158.0-written file fine, so the workaround does not require config cleanup.

## Environment

- doctl: v1.158.0
- OS: Ubuntu (self-hosted GitHub Actions runner, Linux x86_64)
- Action: `digitalocean/action-doctl@v2` with `version: 'latest'` (default)

## Workaround applied on our side

Pinning `version: '1.157.0'` in all `digitalocean/action-doctl@v2` callsites until v1.159.0 (or v1.158.x) ships a fix.

Happy to provide the corrupted config file (with secrets redacted) on request.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.