Angular: NG0912: Component ID generation collision detected. Components 'A' and 'B' with selector 'app-x' use the same ID
Angular generated the same internal id for two different components — usually two components with the same selector, template and styles.
NG0912: Component ID generation collision detectedComponent ID generation collision detecteduse the same ID Meaning
Component ids are derived from selector, template, styles and more. Collisions are a warning in dev mode and can break style encapsulation (one component gets the other's styles). Make the components differ (unique selector, class name) or set an explicit id in the decorator.
Common causes
- Two components with the same selector, template and styles
- Copy-pasted component not edited
- A library bundled twice with different versions
- Generated components from a template with identical metadata
- Test doubles redefining a component with the same decorator
⚡ Quick fix
- Give each component a unique selector
- Set a distinct
idin the@Componentoptions - Deduplicate the library version (check lockfile)
Detailed fix by platform
Angular
- Rename the selector or add
id: 'unique-id'to@Component({...}) - Run
npm ls @angular/coreto spot duplicate Angular copies
How to diagnose
- Components — Which two are named?
- Duplicates — Same metadata?
- Packages — Two copies of the same library?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Can't find stylesheet to import Angular (Sass): Error: Can't find stylesheet to import. @import 'variables';
- Cannot find control with name Angular: Error: Cannot find control with name: 'email' (reactive forms)
- exceeded maximum budget Angular build: Error: bundle initial exceeded maximum budget. Budget 1.00 MB was not met by 120.00 kB with a total of 1.12 MB
Most viewed in Angular
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 15 Oct 2026