Foundry376/Mailspring · error · InvalidPackageNameError
Plugin in ${dir} has an invalid or missing "name" field. Nam
Error message
Plugin in ${dir} has an invalid or missing "name" field. Names must match /^[a-zA-Z0-9._-]+$. What it means
InvalidPackageNameError thrown from the Plugin class constructor while loading a plugin's package.json: the manifest parsed but its name field is missing or contains characters outside /^[a-zA-Z0-9._-]+$. Fires at startup when scanning plugin directories (internal_packages and user plugins).
Source
Thrown at app/src/package.ts:46
public windowTypes: { [windowName: string]: boolean };
private json: any;
constructor(dir: string) {
this.directory = dir;
let jsonString = null;
try {
jsonString = fs.readFileSync(path.join(dir, 'package.json')).toString();
} catch (err) {
// silently fail, not a file
}
if (!jsonString) {
throw new NoPackageJSONError();
}
this.json = JSON.parse(jsonString);
if (!isValidPackageName(this.json.name)) {
throw new InvalidPackageNameError(
`Plugin in ${dir} has an invalid or missing "name" field. Names must match /^[a-zA-Z0-9._-]+$/.`
);
}
this.name = this.json.name;
this.displayName = this.json.displayName || this.json.name;
this.syncInit = this.json.syncInit;
this.windowTypes = this.json.windowTypes || { default: true };
}
activate() {
const start = Date.now(); // eslint-disable-line
this.loadKeymaps();
this.loadMenus();
this.loadStylesheets();
if (this.json.main) {
const root = path.join(this.directory, this.json.main);View on GitHub (pinned to 648c685d60)
Solutions
- Edit the plugin's package.json and set a name matching /^[a-zA-Z0-9._-]+$/ (letters, digits, dot, underscore, hyphen only — no spaces)
- Remove or uninstall the offending plugin if it is not needed
- Check third-party plugins installed into the user plugins directory
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at app/src/package.ts:46 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/a77d8932bb618073.
Report an issue: GitHub.