You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Warn or recover explicitly when config.json cannot be parsed #25
If the config file is truncated or manually edited into invalid JSON, opencodex silently starts with defaults. Later code paths can save the in-memory default config, making the user's provider setup appear to have disappeared.
This is especially confusing because provider credentials/configuration are user-managed state, and a parse failure likely indicates a recoverable local file problem rather than a real first-run state.
Possible directions
Print a warning that includes the config path and parse/read error.
Preserve the invalid file as config.json.invalid.<timestamp> before writing a replacement.
Refuse to overwrite the config until the user fixes or confirms recovery.
Add a small test around invalid JSON handling so this does not regress silently.
I am filing this separately because the desired recovery behavior is partly UX policy, not only implementation.
Activity
lidge-jun commentedon Jun 25, 2026
Implemented on
devin4d9d9f9(fix: preserve invalid config before fallback), rebuilt from PR #26 with 0disoft / ZeroDi credited as co-author.Behavior now:
config.jsonis copied toconfig.json.invalid-<timestamp>before fallback;loadConfig()warns once per config path with the parse/schema reason;defaultProvideris validated when the provider map is non-empty;port: 0andproviders: {}remain loadable.Verification:
bun run typecheck: passbun run privacy:scan: passbun test tests: 356 pass / 0 fail28138885594: ubuntu-latest and windows-latest successLeaving the issue open until this
devfix is merged/released from the mainline.lidge-jun commentedon Jun 25, 2026
Resolved. The fix landed in
4d9d9f9(fix: preserve invalid config before fallback), merged tomainvia PR #28, and shipped in v2.1.11+.Behavior now:
config.jsonis backed up toconfig.json.invalid-<timestamp>before fallbackloadConfig()warns once per config path with the backup locationconfigSchema) catches structural issuesdefaultProvideris validated against configured providersREADME and docs-site configuration reference have been updated to describe this behavior.
docs: document OPENCODEX_API_AUTH_TOKEN and config recovery behavior