Foundry376/Mailspring · error

Failed to parse mailsync output as JSON:

Error message

Failed to parse mailsync output as JSON:

What it means

Warning in MailsyncProcess.onStreamCloseOrExit: the sync engine's buffered stdout could not be JSON.parse'd when the stream closed (and did not carry the 'dbg::' debug prefix). The raw buffer is logged with secrets stripped; lastJSON stays null, which downstream logic treats as 'no final result'. Usually caused by a partial line when the C++ process crashed mid-write.

Source

Thrown at app/src/mailsync-process.ts:432

    const onStreamCloseOrExit = (code: number, signal: string) => {
      if (cleanedUp) {
        return;
      }

      let error = null;
      let lastJSON = null;
      try {
        if (outBuffer.length) {
          // Skip debug output that starts with 'dbg::' prefix
          if (outBuffer.startsWith('dbg::')) {
            console.log('Skipping debug output from mailsync:', this._stripSecrets(outBuffer));
          } else {
            lastJSON = JSON.parse(outBuffer);
          }
        }
      } catch (parseError) {
        console.warn('Failed to parse mailsync output as JSON:', this._stripSecrets(outBuffer));
      } finally {
        if (lastJSON) {
          if (lastJSON.error) {
            error = new Error(this._stripSecrets(lastJSON.error));
          } else {
            this.emit('deltas', [outBuffer]);
          }
        }
      }

      if (errBuffer) {
        error = new Error(this._stripSecrets(errBuffer));
      }

      cleanedUp = true;
      this.emit('close', { code, error, signal } as MailsyncProcessExit);
    };

View on GitHub (pinned to 648c685d60)

Solutions

  1. Inspect the logged raw buffer for a C++ crash message or stack trace preceding the JSON
  2. Check mailsync crash logs / core dumps if this recurs — the process died before flushing a complete JSON line
  3. Update or rebuild Mailspring-Sync if the output format changed
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at app/src/mailsync-process.ts:432 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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