Angular: NG0950: Input is required but no value is available yet (input.required / viewChild.required)
A required signal input or query was read before Angular set it — in the constructor or too early in the lifecycle.
NG0950: Input is required but no value is available yetInput is required but no value is available yetNG0951: Child query result is required but no value is available Meaning
input.required<T>() (and viewChild.required, contentChild.required) throw NG0950 / NG0951 if read before a value exists. Read them in ngOnInit or later, inside computed/effect, or in the template. In tests, set the input with fixture.componentRef.setInput(...) before the first detectChanges.
Common causes
- Reading
this.name()in the constructor or a field initialiser that runs immediately - Parent did not pass the required input (but the compiler is bypassed or the component is created dynamically)
- Test created the component without setting required inputs
- Reading a required view query before the view exists (NG0951)
- Dynamic component creation without
setInput
⚡ Quick fix
- Read the input inside
computed(),effect(), the template, or after init - In tests:
fixture.componentRef.setInput('name', 'Ada')beforedetectChanges() - Use a non-required input with a default if the value can be missing
Detailed fix by platform
Angular
fullName = computed(() =>${this.first()} ${this.last()});instead of reading signals in the constructor- Dynamic:
ref.setInput('id', 7)
Code examples
Read after init
export class UserCardComponent {
user = input.required<User>();
title = computed(() => this.user().name); // computed reads lazily: OK
// constructor() { console.log(this.user()); } // NG0950: nothing set yet
}
// test: fixture.componentRef.setInput('user', { name: 'Ada' }); fixture.detectChanges();How to diagnose
- Timing — Where is the input read?
- Parent — Is the required input bound?
- Test — setInput before detectChanges?
🔧 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
- Cannot find control with name Angular: Error: Cannot find control with name: 'email' (reactive forms)
- Could not find the builder's node package Angular CLI: Could not find the '@angular-devkit/build-angular:browser' builder's node package / Cannot find module '@angular-devkit/build-angular/package.json'
- 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