{"record":{"id":"7d5ccbf0ca3fd2e8","repo":"angular/angular","slug":"duplicate-ng-module-id","errorCode":"DUPLICATE_NG_MODULE_ID","errorMessage":"Duplicate module registered for ${id} - ${stringify(type)} vs ${stringify(type.name)}","messagePattern":"Duplicate module registered for (.+?) - (.+?) vs (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/linker/ng_module_registration.ts","lineNumber":28,"sourceCode":"import {Type} from '../interface/type';\nimport {NgModuleType} from '../metadata/ng_module_def';\nimport {stringify} from '../util/stringify';\n\n/**\n * Map of module-id to the corresponding NgModule.\n */\nconst modules = new Map<string, NgModuleType>();\n\n/**\n * Whether to check for duplicate NgModule registrations.\n *\n * This can be disabled for testing.\n */\nlet checkForDuplicateNgModules = true;\n\nfunction assertSameOrNotExisting(id: string, type: Type<any> | null, incoming: Type<any>): void {\n  if (type && type !== incoming && checkForDuplicateNgModules) {\n    throw new RuntimeError(\n      RuntimeErrorCode.DUPLICATE_NG_MODULE_ID,\n      ngDevMode &&\n        `Duplicate module registered for ${id} - ${stringify(type)} vs ${stringify(type.name)}`,\n    );\n  }\n}\n\n/**\n * Adds the given NgModule type to Angular's NgModule registry.\n *\n * This is generated as a side-effect of NgModule compilation. Note that the `id` is passed in\n * explicitly and not read from the NgModule definition. This is for two reasons: it avoids a\n * megamorphic read, and in JIT there's a chicken-and-egg problem where the NgModule may not be\n * fully resolved when it's registered.\n *\n * @codeGenApi\n */\nexport function registerNgModuleType(ngModuleType: Type<any>, id: string): void {","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/angular/angular/blob/51cb07e98081ab7e4e84a9e0949266a8e19cca84/packages/core/src/linker/ng_module_registration.ts#L10-L46","documentation":"Error \"Duplicate module registered for ${id} - ${stringify(type)} vs ${stringify(type.name)}\" thrown in angular/angular.","triggerScenarios":"Thrown at packages/core/src/linker/ng_module_registration.ts:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the duplicate module registration; ensure each NgModule id is registered once."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"51cb07e98081ab7e4e84a9e0949266a8e19cca84","analyzedAt":"2026-08-22T07:04:54.531Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}