ai-automation-consultant / Failure Lab

TypeScript Null Field

TypeScript compiles, but runtime data includes null where the code expects a string.

Category

typescript

Difficulty

standard

Last Run

none

Incident Brief

Identify why the TypeScript route crashes despite having typed inputs.

Broken State

The API handler casts an external payload to LeadInput without runtime validation, then calls trim on a null phone value.

Symptoms

  • Unit tests with perfect fixtures pass.
  • Production crashes on a partner payload with phone set to null.

Trace

TypeError: Cannot read properties of null (reading 'trim')
payload.source=partner-a field=phone value=null

Diagnosis