argocd: failed to load initial config: invalid character
Routes argocd CLI corrupt-config failures. Use when every argocd command fails with failed to load initial config (invalid character / unexpected end of JSON). Not for auth or TLS errors.
The CLI config file at ~/.config/argocd/config got truncated or corrupted (killed write, disk-full, bad merge) - every command fails parsing it before doing anything. Move it aside and log in again; argocd recreates a clean config. Your clusters and servers are unaffected - only the local session cache is rebuilt.
The error
FATA[0000] failed to load initial config: invalid character 'x' looking for beginning of valueWhat to do
- Quarantine the broken file:
mv ~/.config/argocd/config ~/.config/argocd/config.brokenExpected: No output.
- Log in fresh:
argocd login [server] --grpc-web --username [user]Expected: Login succeeds; clean config written.
- Re-add any other server contexts you used.
Expected: All contexts restored.
- Optional: diff the broken file to learn what corrupted it, then delete it.
Expected: Cleanup done.
When this applies
- the exact failed to load initial config message
- every argocd command failing identically
- after disk-full or killed-write incidents
When it does NOT apply
- single commands failing (not a config parse issue)
- login failures with valid config (auth problem)
Works with
argocd CLI 2.x/3.x
failed to load initial config: unexpected end of JSON input
Same corruption, truncated file. Same move-aside fix.
Why it happens
The CLI loads its JSON config on every invocation before parsing flags. A partially written file fails the JSON parse, and the error surfaces before any command logic runs.
Edge cases
- Back up the config before bulk edits or disk-cleanup scripts touch ~/.config.
- Multiple contexts live in the one file - note which servers you used before deleting it.
Resolved from
computingforgeeks argocd login guide - https://computingforgeeks.com/argocd-cli-login-authentication/
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.