Skip to content

Offer to delete an unreadable config file instead of crashing - #667

Open
mirfalltnixein wants to merge 1 commit into
DavidoTek:mainfrom
mirfalltnixein:fix-config-parse-error
Open

mirfalltnixein wants to merge 1 commit into
DavidoTek:mainfrom
mirfalltnixein:fix-config-parse-error

Conversation

@mirfalltnixein

@mirfalltnixein mirfalltnixein commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #361

A config file that ConfigParser can't parse, such as one with github_api_token set twice, crashes ProtonUp-Qt on startup at the first config read (apply_dark_theme → config_theme → read_update_config_value).

This follows the plan from the issue: before that first read, main() calls a new check_config_file(). If the file can't be parsed, it shows a warning with the parser's message (which names the option or section, the file and the line) and two buttons:

  • Delete config (default): deletes the file and starts with the default settings.
  • Exit, I'll fix it myself: exits and leaves the file alone. Closing the dialog does the same, so nothing is deleted by accident.

The check runs once at startup, so the three places that read the config (read_update_config_value, install_directory, config_custom_install_location) stay unchanged. It also covers the other parser errors, such as a duplicated section or a missing section header.

Testing:

  • New parametrized test for get_config_file_error (missing file, valid file, duplicate option, duplicate section, no section header). No Qt dialog test, after the feedback on Batch update: match Proton tool names case-insensitively #662.
  • QT_QPA_PLATFORM=offscreen pytest -q: 172 passed.
  • Ran it from source with XDG_CONFIG_HOME pointing at a config with a duplicated github_api_token. Exit: the dialog appeared, ProtonUp-Qt exited and the file was kept. Delete config: the main window opened and a fresh default config was written.

🤖 Generated with Claude Code

Fixes DavidoTek#361

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DuplicateOptionsError (crash on startup)

1 participant