scw fails to parse ~/.config/scw/config.yaml after a manual edit
Fixes scaleway-cli failing to load after a hand-edited config.yaml. Use when scw errors on startup right after editing ~/.config/scw/config.yaml. The fix is validating the YAML and restoring the profile structure (or re-running scw init). Not for bad credentials.
You broke the YAML. Validate ~/.config/scw/config.yaml, fix the indentation (spaces only), or re-run scw init to rewrite the profile cleanly. Back the file up before hand-editing; a broken config fails every command before it even reaches the API.
$ scw instance server list
error: unable to parse config file: yaml: line 6: did not find expected keyFix
- Validate:
python3 -c "import yaml; yaml.safe_load(open('$HOME/.config/scw/config.yaml'))" && echo YAML-OKThe traceback names the offending line.
- Fix tabs, indentation, and duplicated keys, or restore from backup.
- Nuclear option that always works: re-run setup and re-enter values:
scw initExpected: profile rewritten, commands work.
- Going forward:
cp ~/.config/scw/config.yaml ~/.config/scw/config.yaml.bakWhen this applies
- scw fails at startup with a config/parse error after a manual edit.
- The error mentions the config file, not the API.
When it does NOT apply
- API auth errors: the file parses, the credentials are the problem.
- Missing defaults: valid YAML, missing settings; use
scw config set.
Compatibility
- scaleway-cli (scw) v2.
Why it happens
scw parses the entire config at startup; one bad line poisons every profile in the file. YAML's whitespace sensitivity plus editors that insert tabs is the usual cause.
Edge cases
- The file holds secrets; keep it 0600 and never commit it.
- Prefer `scw config set key [your value] over hand-editing; it writes valid YAML for you.
- A missing file is fine (scw falls back to env vars); a broken file is not. Move it aside to test.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.