n8n-errors-expressions
Installation
SKILL.md
n8n Expression Error Diagnosis
Diagnose and fix expression evaluation failures in n8n v1.x workflows. For error type details see references/methods.md. For before/after fixes see references/examples.md. For anti-patterns see references/anti-patterns.md.
Quick Diagnostic Table
| Symptom | Cause | Fix |
|---|---|---|
undefined when accessing $json.field |
Field does not exist on current item | Check field name spelling; use $json?.field or $ifEmpty($json.field, fallback) |
TypeError: Cannot read properties of undefined |
Accessing nested field on null/undefined parent | Chain optional access: $json.parent?.child?.value |
$itemIndex is not defined in Code node |
$itemIndex is NOT available in Code node |
Use items.indexOf(item) or loop index variable instead |
$secrets is not defined in Code node |
$secrets is NOT available in Code node |
Use $env.SECRET_NAME or pass secret via preceding Set node |
$response is not defined |
$response used outside HTTP Request node |
ONLY use $response in HTTP Request node parameter fields |
Paired item not found |
Item linking broken between nodes | Use $("<Node>").first() or $("<Node>").all()[index] instead of .item |
Related skills