Skip to content

RStudio Desktop never starts when config.json is corrupt; the fallback error dialog throws "application not set" #19496

Closed

Description

@kevinushey

System details

RStudio Edition : Desktop
RStudio Version : reported on 2025.09.2+418; same startup ordering on main (dd65ab2091)
OS Version      : Ubuntu 24.10 and Fedora 43 reported; the code path is the same on all platforms
R Version       : n/a

Steps to reproduce the problem

  1. Quit RStudio Desktop.
  2. Truncate the Electron settings file: : > ~/.config/RStudio/config.json (or write a few NUL bytes into it to mimic a crash or power loss mid-write).
  3. Run rstudio from a terminal.

Describe the problem in detail

No window appears. The terminal prints:

[utils.ts] [createStandaloneErrorDialog] Error when creating Standalone Error Dialog:  Error: application not set
Unexpected end of JSON input

(or Unexpected token '�', "�;9�M"... is not valid JSON for a zero-filled file).

DesktopOptionsImpl constructs its electron-store with only schema and no clearInvalidConfig (src/node/desktop/src/main/preferences/electron-desktop-options.ts), so conf rethrows the JSON SyntaxError from the constructor. That happens inside initializeRenderingEngine() in main.ts, which runs before setApplication(). The catch in RStudioMain.main() then calls createStandaloneErrorDialog, which needs appState().modalTracker (utils.ts), and appState() throws "application not set" because the singleton was never set. The user gets no dialog and the process exits. The only recovery users have found is deleting ~/.config/RStudio (and the sibling lowercase ~/.config/rstudio).

config.json is the store written most often (zoom level, window bounds on every close), so it is the one most likely to be truncated by a crash. By contrast r-environment.json already uses clearInvalidConfig: true and the macOS startup-state.json read is wrapped in try/catch.

Forum reports: https://forum.posit.co/t/209528 , https://forum.posit.co/t/209785
Related: #14690 (a schema violation in the same file also prevented launch)

Describe the behavior you expected

A corrupt config.json should be moved aside (e.g. config.json.corrupt-<timestamp>) and RStudio should start with default desktop options, logging a warning. If startup does fail before the Application singleton exists, the standalone error dialog should still appear (fall back to a plain dialog.showMessageBox when appState() is unavailable), or setApplication() should run before anything that can throw.

Activity

  1. added
    startup
    on Nov 6, 2026
  2. self-assigned this
    on Nov 6, 2026
  3. added theissue type on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugelectronstartup

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions