{"record":{"id":"7c2ebee732c6db37","repo":"vuejs/vuex","slug":"missing-module-modulename-for-path-path","errorCode":null,"errorMessage":"Missing module \"${moduleName}\" for path \"${path}\".","messagePattern":"Missing module \"(.+?)\" for path \"(.+?)\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/plugins/devtool.js","lineNumber":276,"sourceCode":"          }\n        }\n        target = target[p]._custom.value\n      })\n      target[leafKey] = canThrow(() => getters[key])\n    } else {\n      result[key] = canThrow(() => getters[key])\n    }\n  })\n  return result\n}\n\nfunction getStoreModule (moduleMap, path) {\n  const names = path.split('/').filter((n) => n)\n  return names.reduce(\n    (module, moduleName, i) => {\n      const child = module[moduleName]\n      if (!child) {\n        throw new Error(`Missing module \"${moduleName}\" for path \"${path}\".`)\n      }\n      return i === names.length - 1 ? child : child._children\n    },\n    path === 'root' ? moduleMap : moduleMap.root._children\n  )\n}\n\nfunction canThrow (cb) {\n  try {\n    return cb()\n  } catch (e) {\n    return e\n  }\n}\n","sourceCodeStart":258,"sourceCodeEnd":291,"githubUrl":"https://github.com/vuejs/vuex/blob/bd907467b8392d6671bb115738285ff7f63d0cf6/src/plugins/devtool.js#L258-L291","documentation":"Vuex devtools integration walks a module path (e.g. 'root/cart/items') through the module tree via _children. If any segment of the path does not exist in the module map, getStoreModule throws. This means the devtools asked for a module path that no longer matches the registered module hierarchy.","triggerScenarios":"Calling addDevtools (store creation with devtool enabled) with a devtools event path referencing a module name not present under root._children; e.g. path 'root/user/profile' when module 'profile' was never registered or was unregistered.","commonSituations":"Hot module replacement removed/renamed a module while devtools holds a stale path; typo in module name in devtools plugin config; unregisterModule called before devtools re-reads state; async module registration ordering during store init.","solutions":["Verify the module path segments actually match registered module names exactly (case-sensitive)","Register the missing module with registerModule before the devtools flush","Re-create the store or reload devtools so stale paths from HMR are cleared","Check that the path is prefixed with 'root' as getStoreModule expects"],"exampleFix":"// before\nstore.registerModule('cart', cartModule) // devtools path says 'root/basket'\n// after\nstore.registerModule('basket', basketModule) // names now match devtools path 'root/basket'","handlingStrategy":"try-catch","validationCode":"function modulePathExists(store, path) {\n  return path.split('/').filter(Boolean).slice(1).every(seg => {\n    let m = store._modules root check; return typeof store.hasModule === 'function' ? store.hasModule(path.split('/').filter(Boolean).slice(1)) : false\n  })\n}\n// simpler: verify registration before devtools read:\n// path.split('/').filter(n => n).slice(1).every(seg => registeredNames.includes(seg))","typeGuard":"function hasModulePath(store, path) {\n  const names = path.split('/').filter(n => n)\n  if (names[0] !== 'root') return false\n  return names.slice(1).length === 0 ? true : store.hasModule(names.slice(1))\n}","tryCatchPattern":"try {\n  const mod = getStoreModule(moduleMap, path)\n} catch (e) {\n  if (/Missing module/.test(e.message)) { console.warn('stale devtools path, re-registering', path) /* re-register or resubscribe */ }\n  else throw e\n}","preventionTips":["Keep devtools module paths derived from the same source of truth as registerModule calls","Re-init devtools subscription after unregisterModule or HMR updates","Always prefix devtool paths with 'root'","Avoid renaming modules without updating devtool plugin config"],"tags":["vuex","devtools","module-registration","path-resolution"],"backgroundTag":"missing-module-path","analyzedSha":"bd907467b8392d6671bb115738285ff7f63d0cf6","analyzedAt":"2026-08-28T21:38:57.320Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}