rstudio / rstudio

RStudio is an integrated development environment (IDE) for R
https://posit.co/products/open-source/rstudio/
Other
4.59k stars 1.08k forks source link

"Config schema violation" preventing RStudio from launching #14690

Open kevinushey opened 1 month ago

kevinushey commented 1 month ago
Screenshot 2024-05-10 at 4 05 44 PM
Uncaught Exception:
Error: Config schema violation: `view/zoomLevel` must be >= 0.25
at e.exports._validate (/Applications/RStudio.app/Contents/Resources/app-arm64/.webpack/main/index.js:8:50428)
at set store (/Applications/RStudio.app/Contents/Resources/app-arm64/.webpack/main/index.js:8:49387)
at e.exports.set (/Applications/RStudio.app/Contents/Resources/app-arm64/.webpack/main/index.js:8:48155)
at I.zoomLevel (/Applications/RStudio.app/Contents/Resources/app-arm64/.webpack/main/index.js:20:52721)
at IpcMainImpl.<anonymous> (/Applications/RStudio.app/Contents/Resources/app-arm64/.webpack/main/index.js:20:21061)
at IpcMainImpl.emit (node:events:518:28)
at WebContents.<anonymous> (node:electron/js2c/browser_init:2:83555)
at WebContents.emit (node:events:518:28)

I'm not quite sure how I got into this state, but if some configuration setting we have fails the schema validation, we should just set a safe default instead of failing altogether.

kevinushey commented 1 month ago

One way to simulate this, on macOS: open the file at ~/Library/Application Support/RStudio/config.json, and change the zoomLevel parameter to a value like 100. Then, if you try to run RStudio from the command line:

$ /Applications/RStudio.app/Contents/MacOS/RStudio
[utils.ts] [createStandaloneErrorDialog] Error when creating Standalone Error Dialog:  Error: application not set
    at s (/Applications/RStudio.app/Contents/Resources/app-arm64/.webpack/main/index.js:8:337336)
    at t.createStandaloneErrorDialog (/Applications/RStudio.app/Contents/Resources/app-arm64/.webpack/main/index.js:20:86492)
    at Object.main (/Applications/RStudio.app/Contents/Resources/app-arm64/.webpack/main/index.js:20:40285)
Config schema violation: `view/zoomLevel` must be <= 5

This is still a bit curious though, since the error I'm seeing is slightly different than the one here, and the zoomLevel set in my configuration file was correct (so it must've been getting read elsewhere?)

gtritchie commented 2 weeks ago

I hit this as well. My repro steps:

I get that error, and ultimately have to kill the desktop process (and sometimes also the rsession process).

This scenario causes config.json to be missing the zoomLevel entry altogether.

Also, you need to have no "legacy" setting for zoomLevel (from having run pre-Electron desktop), otherwise, that will be used and this problem won't happen. The clean-rstudio script also cleans that up, hence the above steps will hit the bug.