Foundry376/Mailspring · error · Error

Mailspring does not support stylesheets with the extension…

Error message

Mailspring does not support stylesheets with the extension: %@

What it means

cssContentsOfStylesheet was given a stylesheet whose extension is neither .less nor .css. Only those two formats are supported by the theme system; any other extension (or a path with no extension) is rejected instead of being read blindly.

Solutions

  1. Rename the stylesheet to .css or convert it to .less
  2. Pass the path without relying on extension inference for non-style assets
  3. Fix the theme/package manifest that references the unsupported file
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at app/src/theme-manager.ts:310 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/054b3b1842da42e5. Report an issue: GitHub.

Appendix: source

Thrown at app/src/theme-manager.ts:310

      const p = path.resolve(__dirname, stylesheetPath);
      return fs.existsSync(p) ? p : null;
    }
    for (const ext of ['css', 'less']) {
      const p = path.resolve(__dirname, `${stylesheetPath}.${ext}`);
      if (fs.existsSync(p)) return p;
    }
    return null;
  }

  cssContentsOfStylesheet(stylesheetPath) {
    const ext = path.extname(stylesheetPath);

    if (ext === '.less') {
      return this.cssContentsOfLessStylesheet(stylesheetPath);
    } else if (ext === '.css') {
      return fs.readFileSync(stylesheetPath, 'utf8');
    } else {
      throw new Error(
        localized(`Mailspring does not support stylesheets with the extension: %@`, ext)
      );
    }
  }

  cssContentsOfLessStylesheet(lessStylesheetPath) {
    try {
      const less = fs.readFileSync(lessStylesheetPath, 'utf8').toString();
      return this.lessCache.cssForFile(lessStylesheetPath, less);
    } catch (error) {
      let message = `Error loading Less stylesheet: ${lessStylesheetPath}`;
      let detail = error.message;

      if (error.line !== undefined) {
        message = `Error compiling Less stylesheet: ${lessStylesheetPath}`;
        detail = `Line number: ${error.line}\n${error.message}`;
      }
      console.error(message, { detail, dismissable: true });

View on GitHub (pinned to 648c685d60)