Skip to content

Fix 'General' settings not available after upgrade (blocks startup)#3013

Merged
HelioGuilherme66 merged 1 commit intorobotframework:developfrom
chelslava:fix-issue-3000-general-settings
Mar 29, 2026
Merged

Fix 'General' settings not available after upgrade (blocks startup)#3013
HelioGuilherme66 merged 1 commit intorobotframework:developfrom
chelslava:fix-issue-3000-general-settings

Conversation

@chelslava
Copy link
Copy Markdown

Summary

  • Fixes critical bug where RIDE fails to start after upgrade when 'General' settings section is missing
  • Adds settings migration from version 8 to 9 that ensures General section exists with all required keys
  • Adds safe access to General settings in multiple files using .get() with fallback values

Problem

After upgrading RIDE, the application crashes on startup with:

KeyError: 'General'
OnInit returned false, exiting...

This happens when:

  1. User's settings file is corrupted or incomplete
  2. Settings migration from older versions doesn't create the General section
  3. Direct dictionary access settings['General'] fails

Root Cause

Multiple files accessed settings['General'] directly without checking if the section exists:

  • application.py:150 - self.settings['General'].get('font size', 12)
  • mainframe.py:163 - application.settings['General']
  • treeplugin.py:291 - settings.get_without_default('General')
  • dialog.py:34 - _settings['General']

Solution

  1. Added migration migrate_from_8_to_9() - Creates General section with default values if missing
  2. Safe dictionary access - Changed all direct ['General'] access to .get('General', {}) with fallback values
  3. Defensive coding - All General settings now have sensible defaults

Files Modified

  • src/robotide/preferences/settings.py - Added migration method
  • src/robotide/preferences/settings.cfg - Updated version to 9
  • src/robotide/application/application.py - Safe access to font settings
  • src/robotide/ui/mainframe.py - Safe access to general settings
  • src/robotide/ui/treeplugin.py - Safe access to theme settings
  • src/robotide/widgets/dialog.py - Safe access to dialog settings

Testing

  • Tested by simulating missing General section in settings
  • Application starts successfully with default values
  • Existing settings are preserved and merged correctly

Closes #3000

- Add migration from settings version 8 to 9 that ensures General section exists with all required keys
- Add safe access to General settings in application.py, mainframe.py, treeplugin.py, and dialog.py
- Use .get() with fallback values instead of direct dictionary access
- This prevents KeyError when user settings file is missing or corrupted

Closes robotframework#3000
@HelioGuilherme66 HelioGuilherme66 merged commit 9abf0c5 into robotframework:develop Mar 29, 2026
5 checks passed
HelioGuilherme66 pushed a commit to HelioGuilherme66/RIDE that referenced this pull request Mar 29, 2026
…obotframework#3013)

- Add migration from settings version 8 to 9 that ensures General section exists with all required keys
- Add safe access to General settings in application.py, mainframe.py, treeplugin.py, and dialog.py
- Use .get() with fallback values instead of direct dictionary access
- This prevents KeyError when user settings file is missing or corrupted

Closes robotframework#3000
HelioGuilherme66 added a commit that referenced this pull request Mar 29, 2026
* Add options to make visible spaces and newlines in Text Editor.

* Fix 'General' settings not available after upgrade (blocks startup) (#3013)

- Add migration from settings version 8 to 9 that ensures General section exists with all required keys
- Add safe access to General settings in application.py, mainframe.py, treeplugin.py, and dialog.py
- Use .get() with fallback values instead of direct dictionary access
- This prevents KeyError when user settings file is missing or corrupted

Closes #3000

* Enable visible spaces and newlines in External/Code Editor.

---------

Co-authored-by: ChelSlava <chelslava@gmail.com>
HelioGuilherme66 added a commit to HelioGuilherme66/RIDE that referenced this pull request Mar 31, 2026
* Add options to make visible spaces and newlines in Text Editor.

* Fix 'General' settings not available after upgrade (blocks startup) (robotframework#3013)

- Add migration from settings version 8 to 9 that ensures General section exists with all required keys
- Add safe access to General settings in application.py, mainframe.py, treeplugin.py, and dialog.py
- Use .get() with fallback values instead of direct dictionary access
- This prevents KeyError when user settings file is missing or corrupted

Closes robotframework#3000

* Enable visible spaces and newlines in External/Code Editor.

---------

Co-authored-by: ChelSlava <chelslava@gmail.com>
HelioGuilherme66 added a commit to HelioGuilherme66/RIDE that referenced this pull request Mar 31, 2026
* Add visible searching indicator to Find Usages dialog

Closes robotframework#2672

The 'searching...' indicator is now shown as the first row in the
results table, making it more visible to users who focus on the
table rather than the dialog title.

* Make visible spaces and newlines in Text Editor. (robotframework#3026)

* Add options to make visible spaces and newlines in Text Editor.

* Fix 'General' settings not available after upgrade (blocks startup) (robotframework#3013)

- Add migration from settings version 8 to 9 that ensures General section exists with all required keys
- Add safe access to General settings in application.py, mainframe.py, treeplugin.py, and dialog.py
- Use .get() with fallback values instead of direct dictionary access
- This prevents KeyError when user settings file is missing or corrupted

Closes robotframework#3000

* Enable visible spaces and newlines in External/Code Editor.

---------

Co-authored-by: ChelSlava <chelslava@gmail.com>

* Restore wrongly deleted test fixture

* Add ChelSlova PR to improve visibility off Search in Find Usages

---------

Co-authored-by: ChelSlava <chelslava@gmail.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.

2 participants