{"record":{"id":"a77d8932bb618073","repo":"Foundry376/Mailspring","slug":"plugin-in-dir-has-an-invalid-or-missing-name","errorCode":null,"errorMessage":"Plugin in ${dir} has an invalid or missing \"name\" field. Names must match /^[a-zA-Z0-9._-]+$.","messagePattern":"Plugin in (.+?) has an invalid or missing \"name\" field\\. Names must match /\\^\\[a-zA-Z0-9\\._-\\]\\+\\$\\.","errorType":"exception","errorClass":"InvalidPackageNameError","httpStatus":null,"severity":"error","filePath":"app/src/package.ts","lineNumber":46,"sourceCode":"  public windowTypes: { [windowName: string]: boolean };\n  private json: any;\n\n  constructor(dir: string) {\n    this.directory = dir;\n\n    let jsonString = null;\n    try {\n      jsonString = fs.readFileSync(path.join(dir, 'package.json')).toString();\n    } catch (err) {\n      // silently fail, not a file\n    }\n    if (!jsonString) {\n      throw new NoPackageJSONError();\n    }\n\n    this.json = JSON.parse(jsonString);\n    if (!isValidPackageName(this.json.name)) {\n      throw new InvalidPackageNameError(\n        `Plugin in ${dir} has an invalid or missing \"name\" field. Names must match /^[a-zA-Z0-9._-]+$/.`\n      );\n    }\n    this.name = this.json.name;\n    this.displayName = this.json.displayName || this.json.name;\n    this.syncInit = this.json.syncInit;\n    this.windowTypes = this.json.windowTypes || { default: true };\n  }\n\n  activate() {\n    const start = Date.now(); // eslint-disable-line\n\n    this.loadKeymaps();\n    this.loadMenus();\n    this.loadStylesheets();\n\n    if (this.json.main) {\n      const root = path.join(this.directory, this.json.main);","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/Foundry376/Mailspring/blob/648c685d602ece6bb00c22534b8734de6ac644b3/app/src/package.ts#L28-L64","documentation":"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).","triggerScenarios":"Thrown at app/src/package.ts:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"648c685d602ece6bb00c22534b8734de6ac644b3","analyzedAt":"2026-09-03T02:00:24.311Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}