Foundry376/Mailspring · error

config json appears empty

Error message

config json appears empty

What it means

Startup validation in ConfigPersistenceManager.load: the user's config.json parsed to an empty/whitespace payload (e.g. truncated by a crash or power loss mid-write), so the config cannot be loaded. It drives the dialog offering Quit, Try Again, or Reset Configuration.

Solutions

  1. Choose 'Try Again' if the file may have been momentarily locked (antivirus, sync agent)
  2. Choose 'Reset Configuration' to regenerate a fresh config and re-onboard accounts
  3. Write config atomically (temp file + rename) to prevent truncation in the first place
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at app/src/browser/config-persistence-manager.ts:90 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Foundry376/Mailspring@648c685d60 (2026-09-03). Data as JSON: /api/errors/c4588df52bcb4528. Report an issue: GitHub.

Appendix: source

Thrown at app/src/browser/config-persistence-manager.ts:90

      detail,
      buttons: [localized('Quit'), localized('Try Again'), localized('Reset Configuration')],
    });

    // On Windows, `cancelId` is ignored by Electron, so dismissing the dialog without
    // clicking a button (eg: via the window's close button, Alt+F4, or Esc) can return
    // an index outside 0-2. Treat that the same as "Quit" rather than throwing, since
    // this runs synchronously during app startup and an uncaught error here prevents
    // the app from launching at all.
    return ['quit', 'tryagain', 'reset'][clickedIndex] || 'quit';
  }

  load() {
    this.userWantsToPreserveErrors = false;

    try {
      const json = JSON.parse(fs.readFileSync(this.configFilePath).toString());
      if (!json || !json['*']) {
        throw new Error('config json appears empty');
      }
      this.settings = json['*'];
      this.emitChangeEvent();
    } catch (error) {
      error.message = localized(`Failed to load config.json: %@`, error.message);

      const action = this._showLoadErrorDialog(error);
      if (action === 'quit') {
        this.userWantsToPreserveErrors = true;
        app.quit();
        return;
      }

      if (action === 'tryagain') {
        this.load();
        return;
      }

View on GitHub (pinned to 648c685d60)