# Missing Control Value

This error occurs when you call `setValue` on a `FormGroup` or `FormArray` but the value you pass is missing an entry for one of the registered controls.

`setValue` is strict — it expects a value for every control. If you want to update only some controls, use `patchValue` instead.

## Debugging the error

Check which control is named in the error message, then make sure your value object includes it.

A common source of this error is spreading an object that doesn't have all the keys:

```typescript
const someValue = {first: 'Nancy'}; // 'last' is missing

form.setValue({...someValue}); // throws NG01002
```

This can happen if `someValue` comes from an API response, a partial state update, or a type that doesn't fully match the form structure. In those cases, either fill in the missing keys explicitly or switch to `patchValue`.

### FormGroup

```typescript
const form = new FormGroup({
  first: new FormControl(''),
  last: new FormControl(''),
});

// 'last' is not in the value — throws NG01002
form.setValue({first: 'Nancy'});

// both controls are covered — works fine
form.setValue({first: 'Nancy', last: 'Drew'});
```

### FormArray

```typescript
const formArray = new FormArray([new FormControl(''), new FormControl('')]);

// only one value for two controls — throws NG01002
formArray.setValue(['Nancy']);

// one value per control — works fine
formArray.setValue(['Nancy', 'Drew']);
```
