Skip to content

Node Red Flow Error

DodaTech 3 min read

In this tutorial, you'll learn about Node. We cover key concepts, practical examples, and best practices.

Hook

You press "Deploy" in Node-RED, and the status bar turns red: "Error: Flow contains errors." The tooltip does not show which node or what the error is. Your entire automation suite is stuck in an un-deployed state.

The Wrong Way

Deleting the suspect flow tab and re-importing from a backup is slow and may re-introduce the same error if the backup also has issues.

# BAD: Deleting the entire flow and re-importing
curl -X DELETE http://localhost:1880/flow/flow-id
curl -X POST -H "Content-Type: application/json" -d @backup.json http://localhost:1880/flow
Flow replaced
Same deploy error: "Flow contains errors"

The backup had the same problem. You deleted your flow for nothing.

The Right Way

Use the Node-RED editor's built-in error inspection or the API to find the exact node causing the problem.

# 1. Deploy via CLI to see the full error
curl -s -X POST -H "Content-Type: application/json" \
  http://localhost:1880/flows | jq '.flows[0].error // .error'
{
  "message": "Error: Invalid credentials for MQTT node 'Broker Config'"
}
# 2. Identify the specific flow and node with errors
curl -s http://localhost:1880/flows | jq '.flows[] | select(.error != null) | {label, id, error}'
{
  "label": "Weather Automation",
  "id": "abc123",
  "error": "Missing property: server"
}
# 3. In the editor, open the Debug sidebar (Ctrl+Shift+D)
# Check for red error badges on nodes
# 4. Fix the node — update the missing property
# For the MQTT node: double-click it → Edit → Select broker → Update
# 5. Re-deploy
curl -X POST -H "Content-Type: application/json" -d '{}' http://localhost:1880/deploy
Deploy successful — 12 flows active
No errors ✓

If you cannot fix via UI, edit the flow JSON directly:

# Export the specific flow
curl -s "http://localhost:1880/flow/abc123" | jq '. > /tmp/flow.json
# Edit and re-import

Prevention

  • Enable the "Check all nodes on deploy" option in Node-RED settings.
  • Test new flows in a separate tab before merging into production.
  • Keep flow backups exported via the editor's Export menu.
  • Use meaningful node names for easier error identification.
  • Set flowFilePretty: true in settings.js for readable flow JSON files.

Common Mistakes with red flow error

  1. Using foldl instead of foldl' causing stack overflow on large lists
  2. Forgetting deriving (Show, Eq) on custom data types needed for debugging
  3. Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable

These mistakes appear frequently in real-world NODE code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

How do I find which node has an error without clicking every node?

Press Ctrl+F in the editor and search for "error" — nodes with errors have red CSS classes. Or use the API: /flows returns error details per flow.

What does 'Invalid wiring' mean?

A wire is connected to a port that does not match the expected type (e.g., wiring a string output to a numeric input). Check wire colors — they should match between connected ports.

Can a missing module cause deploy errors?

Yes — if a flow uses a node type that is not installed, the deploy fails. Install the missing palette node via Manage Palette → Install. The error usually says "Unknown node type: node-type-name".


DodaTech — deploy your flows without the red error bar.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro