Data Flow & Type Handling
Learn how data flows between nodes in workflows and handle data types correctly to avoid runtime errors.
Overview
In workflows, data flows from one node to the next by referencing outputs from previous nodes or workflow inputs. You control this data flow using {{...}} reference syntax. Each field has a specific data type, and type compatibility is critical for successful workflow execution.
Key Concepts:
Workflow inputs and node outputs have defined types
Node inputs expect specific types
Type mismatches cause workflow failures at runtime
Type conversion nodes help transform data between incompatible types
How Data Flows in Workflows
Understanding how data moves through your workflow is essential for building reliable automations.
Workflow Execution Flow
Workflows execute linearly from top to bottom, with data passing from one node to the next:
1. User provides workflow inputs
β
2. Node 1 executes β produces outputs
β
3. Node 2 executes (can reference Node 1 outputs) β produces outputs
β
4. Node 3 executes (can reference Node 1 & 2 outputs) β produces outputs
β
5. Workflow returns final outputAvailable Data at Each Node
Each node can access:
Workflow inputs: Data provided when the workflow starts
Previous node outputs: Results from any node that executed before it
Cannot access: Future node outputs (nodes that haven't executed yet)
Example:
Controlling Data Flow
You control what data flows between nodes by:
Referencing specific fields - Choose exactly which data to pass
Transforming data - Use conversion techniques to match types
Combining data - Merge multiple sources into one field
How to Reference Data
Use double curly braces {{...}} to reference data in node configurations and text fields:
Reference Workflow Inputs
Example:
Reference Node Outputs
Example:
Use in Text Strings
You can embed references inside text strings - they will always be converted to string type:
Important: When used in strings, all values are automatically converted to text:
Numbers become strings:
{{count}}β"42"Objects become JSON strings:
{{user}}β'{"name":"John"}'Arrays become JSON strings:
{{items}}β'["a","b","c"]'
Nested Field Access
Access nested objects and arrays:
Understanding Data Types
Every field in workflow inputs, node inputs, and node outputs has a specific data type defined in its schema.
Common Data Types
number
Numeric values (int or float)
42, 3.14, -10
boolean
True/false values
true, false
object
JSON objects/dictionaries
{"name": "John", "age": 30}
array
Lists of items
[1, 2, 3], ["a", "b", "c"]
How to Check Field Types
1. Workflow Input Types When defining workflow inputs, you specify the type:
2. Node Input and Output Types Each node defines its input and output types in its schema. Check the node's detail page to see:
What input types each field expects
What output types each field produces
Where to find node type information:
Node Reference Documentation - Browse all 193+ nodes by category
Individual node detail pages - Shows complete input/output schemas
Visual builder node panel - Displays field types when configuring nodes
Type Compatibility Rules
β
Compatible Substitution
You can substitute a field if the types match exactly:
β Incompatible Substitution
Type mismatches will cause runtime errors:
Error at runtime:
Example: Type Mismatch Scenario
Workflow Setup:
Incorrect Configuration:
Error: Cannot assign object to string field.
Correct Configuration:
Access the nested string field directly.
Type Conversion Techniques
When you need to connect fields with different types, use these techniques:
1. String to JSON (Object/Array)
Use Case: Convert JSON string to object or array
Node: string_to_json
Example:
2. Object/Array to String
Use Case: Convert object or array to string
Technique: Use string interpolation (automatic conversion)
When embedded in strings, objects and arrays are automatically converted to JSON string format.
3. Number to String
Use Case: Convert numeric values to text
Technique: Use string interpolation (automatic conversion)
Numbers are automatically converted to strings when embedded in text.
4. Extract Array Item
Use Case: Get a single item from an array
Technique: Use array indexing
5. Extract Object Field
Use Case: Get a specific field from an object
Technique: Use dot notation
6. Custom Transformations with Code
Use Case: Complex type conversions and data transformations
Available Nodes:
run_javascript- Execute JavaScript code for transformationsrun_python_code- Execute Python code for transformations
Example (JavaScript):
Example (Python):
Common Type Mismatch Scenarios
Scenario 1: API Response to Email Body
Problem:
This will work (objects are auto-converted to JSON strings), but you'll get:
Better Solutions:
Solution A: Access the specific field you want
Solution B: Format it nicely in a string
Solution C: Use the whole object if you want JSON
Scenario 2: String ID to Number ID
Problem:
Solution: Use run_javascript or run_python_code to convert
Scenario 3: Multiple Values to Array
Problem:
Solution: Use array construction
Type Validation and Error Messages
Runtime Type Errors
When types don't match, workflows fail with clear error messages:
Example Error:
How to Fix Type Errors
Check the error message - identifies the node, field, expected type, and actual type
Review node documentation - confirm expected input types
Inspect previous node outputs - verify what type is being produced
Add conversion node - insert appropriate type conversion between nodes
Adjust substitution - use dot notation or array indexing to access correct type
Best Practices
1. Verify Types Before Substituting
Always check:
What type does the source field produce?
What type does the target field expect?
Do they match?
2. Use Node Documentation
Refer to the Node Reference to understand:
Input schemas (expected types)
Output schemas (produced types)
3. Test Incrementally
Build workflows step-by-step:
Add a node
Configure inputs with substitution
Run and verify output types
Continue to next node
4. Add Type Conversion Early
If you know types don't match:
Insert conversion nodes immediately
Don't wait for runtime errors
5. Use Explicit Field Access
Instead of:
Use:
6. Handle Arrays Carefully
Remember:
{{node.items}}β entire array{{node.items[0]}}β first item{{node.items[0].name}}β field from first item
Type Conversion Node Reference
Available nodes and techniques for type conversion:
String β Object/Array
string_to_json node
Parse '{"a":1}' β {a: 1}
Object/Array β String
String interpolation
"Data: {{obj}}" β 'Data: {"a":1}'
Number β String
String interpolation
"Count: {{num}}" β "Count: 42"
String β Number
run_javascript / run_python_code
parseInt("42") β 42
Array β String
String interpolation
"Items: {{arr}}" β 'Items: [1,2,3]'
Extract from Array
Array indexing
{{arr[0]}} β first item
Extract from Object
Dot notation
{{obj.field}} β field value
Custom Transform
run_javascript / run_python_code
Any complex conversion
Key Nodes:
string_to_json- Parse JSON strings to objects/arraysrun_javascript- Execute JavaScript for custom transformationsrun_python_code- Execute Python for custom transformationsget_value_by_key- Extract value from object by key name
See Utilities Nodes for complete list.
Troubleshooting Guide
Issue: "Type mismatch" error at runtime
Solution:
Check error message for expected vs. actual type
Add conversion node between incompatible nodes
Use dot notation to access nested fields of correct type
Issue: "Cannot read property of undefined"
Solution:
Verify previous node executed successfully
Check field name spelling:
{{node.field}}must match exactlyEnsure previous node actually outputs that field
Issue: "Invalid JSON" error
Solution:
Verify string is valid JSON before using
string_to_jsonCheck for escaped quotes or formatting issues
Test JSON string in external validator
Issue: Array indexing fails
Solution:
Verify array is not empty: check previous node output
Use valid index:
[0]for first item, not[1]Handle potential empty arrays in workflow logic
Related Documentation
Node Reference - Complete node type documentation
Utilities Nodes - Type conversion nodes
Troubleshooting Workflows - Common workflow errors
Complete Example: Step-by-Step Workflow Execution
Let's walk through a real workflow execution to see exactly what data is available at each step and how the workflow state changes.
Workflow Setup
Workflow Definition:
π STEP 1: User Starts Workflow
User provides inputs:
Workflow State:
What you can reference:
β
{{api_url}}β"https://api.example.com/users/123"β
{{recipient_email}}β"[email protected]"β No node outputs available yet
π STEP 2: Node 1 (fetch_data) Executes
Node Configuration:
After {{...}} substitution, node receives:
Node executes and produces output:
Workflow State after Node 1:
What you can now reference:
β
{{api_url}}β"https://api.example.com/users/123"β
{{recipient_email}}β"[email protected]"β
{{fetch_data.status_code}}β200β
{{fetch_data.response_body}}β{"id": 123, "name": "John Doe", ...}β
{{fetch_data.response_body.name}}β"John Doe"β
{{fetch_data.response_body.status}}β"active"β Cannot reference nodes that haven't executed yet
π STEP 3: Node 2 (analyze_user) Executes
Node Configuration:
After {{...}} substitution, node receives:
Node executes and produces output:
Workflow State after Node 2:
What you can now reference:
β All workflow inputs
β All
fetch_dataoutputsβ
{{analyze_user.content}}β"This user John Doe appears to be..."β Cannot reference nodes that haven't executed yet
π STEP 4: Node 3 (send_report) Executes
Node Configuration:
After {{...}} substitution, node receives:
Node executes and produces output:
Final Workflow State after Node 3:
What you can now reference:
β All workflow inputs
β All outputs from all executed nodes
β
{{send_report.message}}β"Email sent successfully"β
{{send_report.email_id}}β"msg_abc123xyz"
π STEP 5: Workflow Completes
If no output mapping is defined:
The workflow returns the last node's output:
If output mapping is defined:
The workflow returns:
Key Observations from This Example
1. Data Accumulates as You Go:
2. Cannot Reference Future Nodes:
At Node 1, you CANNOT use
{{analyze_user.content}}(hasn't run yet)At Node 2, you CANNOT use
{{send_report.message}}(hasn't run yet)
3. String Interpolation:
"Name is {{fetch_data.response_body.name}}"β"Name is John Doe"Numbers become strings: If
idwas in the string,"ID: {{fetch_data.response_body.id}}"β"ID: 123"Objects become JSON:
"Data: {{fetch_data.response_body}}"β"Data: {\"id\":123,\"name\":\"John Doe\"...}"
4. Exact Field Names Matter:
β
{{fetch_data.response_body}}(correct - matchesApiCallNodeOutput)β
{{fetch_data.response}}(wrong - field doesn't exist)β
{{analyze_user.content}}(correct - matchesAskClaudeOutput)β
{{analyze_user.response}}(wrong - field doesn't exist)
5. Check Node Documentation:
Each node type has specific input and output field names
Always refer to Node Reference for exact field names
Summary
Key Takeaways:
Data Flow:
β Workflows execute top-to-bottom, data flows linearly between nodes
β Each node can access workflow inputs and outputs from previous nodes
β Use
{{...}}syntax to reference data from inputs and previous nodes
Type Handling: 4. β All fields in workflow inputs, node inputs, and node outputs have defined types 5. β Types must match when passing values between nodes 6. β Type mismatches cause runtime errors, not design-time warnings 7. β Check node detail pages to see input/output types
Automatic Conversions: 8. β
When embedded in strings, all values auto-convert to strings 9. β
Objects and arrays become JSON strings: "Data: {{obj}}" works 10. β
Numbers become text: "Count: {{num}}" works
Manual Conversions: 11. β
Use string_to_json to parse JSON strings to objects/arrays 12. β
Use run_javascript or run_python_code for complex transformations 13. β
Use dot notation and array indexing to extract specific values
Best Practices: 14. β
Test workflows incrementally to catch type errors early 15. β
Use explicit field access: {{api.response.data.id}} vs {{api.response}}
Remember: When in doubt, check the node's detail page for exact input/output types!
Last updated
Was this helpful?