{"record":{"id":"1682f8223067c5b7","repo":"parcel-bundler/parcel","slug":"invalid-web-extension-manifest","errorCode":null,"errorMessage":"Invalid Web Extension manifest","messagePattern":"Invalid Web Extension manifest","errorType":"exception","errorClass":"ThrowableDiagnostic","httpStatus":null,"severity":"error","filePath":"packages/transformers/webextension/src/WebExtensionTransformer.js","lineNumber":61,"sourceCode":"  hmrOptions: ?HMROptions,\n) {\n  const hot = Boolean(hmrOptions);\n  const fs = asset.fs;\n  const filePath = asset.filePath;\n  const assetDir = path.dirname(filePath);\n  const isMV2 = program.manifest_version == 2;\n  delete program.$schema;\n  if (program.default_locale) {\n    const locales = path.join(assetDir, '_locales');\n    let err = !(await fs.exists(locales))\n      ? 'key'\n      : !(await fs.exists(\n          path.join(locales, program.default_locale, 'messages.json'),\n        ))\n      ? 'value'\n      : null;\n    if (err) {\n      throw new ThrowableDiagnostic({\n        diagnostic: [\n          {\n            message: 'Invalid Web Extension manifest',\n            origin: '@parcel/transformer-webextension',\n            codeFrames: [\n              {\n                filePath,\n                codeHighlights: [\n                  {\n                    ...getJSONHighlightLocation(ptrs['/default_locale'], err),\n                    message: md`Localization ${\n                      err == 'value'\n                        ? 'file for ' + program.default_locale\n                        : 'directory'\n                    } does not exist: ${path.relative(\n                      assetDir,\n                      path.join(locales, program.default_locale),\n                    )}`,","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/transformers/webextension/src/WebExtensionTransformer.js#L43-L79","documentation":"Thrown by @parcel/transformer-webextension when manifest.json declares default_locale but the expected localization files are missing. The transformer checks the _locales directory (err='key' if the directory itself is absent) and the messages.json inside the locale subfolder (err='value' if the file is missing). The diagnostic highlights the /default_locale pointer in the manifest.","triggerScenarios":"collectDependencies runs with program.default_locale truthy; fs.exists(assetDir/_locales) is false (key error) OR fs.exists(assetDir/_locales/<default_locale>/messages.json) is false (value error).","commonSituations":"Manifest sets \"default_locale\": \"en\" but the _locales directory was never created, the locale code is wrong (en vs en_US), or messages.json was renamed/moved out of the locale folder.","solutions":["Create _locales/<default_locale>/messages.json relative to manifest.json.","Ensure the locale code in default_locale exactly matches the subdirectory name.","Remove the default_locale field if the extension has no internationalization."],"exampleFix":"// before\n{ \"default_locale\": \"en\" }  // no _locales/en/messages.json\n// after\ncreate file: _locales/en/messages.json with { \"msg\": { \"message\": \"...\" } }","handlingStrategy":"validation","validationCode":"const fs = require('fs').promises;\nconst path = require('path');\nif (manifest.default_locale) {\n  const dir = path.join(assetDir, '_locales', manifest.default_locale);\n  const file = path.join(dir, 'messages.json');\n  await fs.access(dir).catch(() => { throw new Error('Missing _locales/' + manifest.default_locale); });\n  await fs.access(file).catch(() => { throw new Error('Missing messages.json for ' + manifest.default_locale); });\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always create _locales/<locale>/messages.json when setting default_locale.","Keep the locale code consistent across default_locale and the folder name.","Drop default_locale if the extension is not internationalized."],"tags":["webextension","manifest","i18n","parcel-transformer"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}