KEEP LEARNING
Build the bigger picture.
The Workflow Engineer connects individual n8n concepts to testing, deployment and running a complete workflow.
Tips > Data, APIs & Webhooks
When a validation or preprocessing node fails or produces no results, downstream nodes should not execute (and waste API calls).
When a validation or preprocessing node fails or returns nothing, downstream nodes should not run and waste API calls. Use n8n expressions to check the previous node's execution status and short-circuit the branch. An IF node testing the upstream result, or a Code node returning empty, stops the flow before expensive enrichment and LLM calls.
When a validation or preprocessing node fails or produces no results, downstream nodes should not execute (and waste API calls). Use n8n expressions to check the previous node's execution status and short-circuit the workflow.
Real-world example: A workflow validates incoming data, enriches it via an API, then sends it to an LLM. If validation fails, the enrichment and LLM calls should not run.
// Code node: "Check Upstream Status"
// Place this before any expensive API call
const prevStatus = $('Validate Data').isExecuted;
const validationResult = $('Validate Data').first().json;
if (!prevStatus || validationResult.valid === false) {
// Return empty to stop this branch, or return an error object
return [{
json: {
skipped: true,
reason: 'Upstream validation failed',
errors: validationResult.errors || ['Unknown validation error'],
apiCallsSaved: 2 // enrichment + LLM
}
}];
}
// Validation passed -- continue with the data
return [{
json: {
skipped: false,
data: validationResult.data
}
}];A simpler approach using the IF node with execution expressions:
IF node configuration:
Condition: Expression
Value 1: {{ $('Validate Data').first().json.valid }}
Operation: equals
Value 2: true
True branch: --> [Enrich via API] --> [Send to LLM]
False branch: --> [Log Failure] --> [End]You can also use $prevNode for simpler chains:
// Expression in an IF node
// Check if the previous node produced any output items
{{ $prevNode.first() !== undefined && $prevNode.first().json.error === undefined }}Cost impact example:
Workflow: Validate --> Enrich ($0.01) --> LLM ($0.03)
Invalid input rate: 30%
Daily executions: 1000
Without status check: 1000 x ($0.01 + $0.03) = $40/day
With status check: 700 x ($0.01 + $0.03) + 300 x $0.00 = $28/day
Savings: $12/day = $360/monthThis pattern ensures you only spend money on API calls that will actually produce useful results.
Related: Use Structured Output (JSON Mode) for Parseable Responses · Configure Payload Size and Binary Data Mode for Large Files
KEEP LEARNING
The Workflow Engineer connects individual n8n concepts to testing, deployment and running a complete workflow.
APPLY IT TO YOUR SYSTEM
Bring the process, the tools involved and an example of where the current workflow gets stuck.