The Problem
The problem is from the context of the Error Workflow I don’t have any parameters that were sent to, or available from the node that errorred. I have a listing of “fieldValues” for the node, but what’s contained in there are the formulas, not the values that they contained during execution. If I could see what the “fieldValues” evaluated to, that would not only give me useful information for the failure, but it would give me a way to pass information through to the Error Workflow.
The reason this matters is that I’m unable to associate the error with the ID of the record that initiated the whole sync process, and therefore I’m unable to report back to the user that initiated the change that a failure occurred. Obviously this defeats a lot of the purpose of error handling.
A solution?
I think the easiest thing you could do from a usability standpoint is to capture the output of all nodes in the workflow that failed, and make them accessible to the Error Workflow (perhaps via the trigger node). If I could do some kind of field mapping at that point and promote the data that I need… that would feel like a really robust solution.
Also it would be nice if in the “node” portion of the error, you included the values that the fields evaluate to, not just the equations.
A Brief Aside: The difficulty of getting any data to test with
With the normal workflows it’s fairly straightforward to get sample data: add your API query, pin the data. For an error workflow, “Fetch Test Event” fetches a generic event that doesn’t have any of the properties on it that you need in order to write the rest of the workflow.
In a roundabout way, I found out how I could get a more useful error to test with:
- Execute the target workflow, triggering an error.
- The error workflow triggers.
- Look at the execution snapshot, put the input in JSON mode, copy it.
- Come back into the designer, edit the input, paste in the JSON from the live event, save it and pin it.
As @leprodude mentions, nested JSON inside the description field isn’t properly escaped. So I need to manually do that. Also, I wish the copy button on the code window had an option to copy the entire contents… it’s not very easy to use right now.
Project Details
What I’m doing: Sync Notion to Webflow
In my case what I’m doing is to synchronize a Notion database with a CMS collection in Webflow.
The Error
Now let’s say we get an error complaining that a field was missing from our output. You can see that on the “description” property towards the bottom.
[
{
"execution": {
"id": "124",
"url": "https://prefix.app.n8n.cloud/workflow/VYoxuNc3PxTtAJzp/executions/124",
"error": {
"level": "warning",
"tags": {
"packageName": "workflow"
},
"context": {},
"functionality": "regular",
"name": "NodeApiError",
"timestamp": 1704336933171,
"node": {
"parameters": {
"authentication": "oAuth2",
"resource": "item",
"operation": "update",
"siteId": "647a35451430c78c1428de79",
"collectionId": "64d6906171b3daae8ef64bd4",
"itemId": "={{ $json['Webflow ID'] }}",
"live": true,
"fieldsUi": {
"fieldValues": [
{
"fieldId": "name",
"fieldValue": "={{ $json.Name }}"
},
{
"fieldId": "description",
"fieldValue": "={{ $json.Description }}"
},
{
"fieldId": "text-color",
"fieldValue": "={{ $json['Text Color'] }}"
},
{
"fieldId": "color",
"fieldValue": "={{ $json.Color }}"
},
{
"fieldId": "slug",
"fieldValue": "={{ $json['Slug Override'] || $json['Default Slug'] }}"
},
{
"fieldId": "_archived",
"fieldValue": "={{ $json.Archived }}"
},
{
"fieldId": "notion-id",
"fieldValue": "={{ $json.id }}"
}
]
}
},
"id": "a8c257ab-6435-4550-9656-d15f260eb922",
"name": "W: Update Category",
"type": "n8n-nodes-base.webflow",
"typeVersion": 1,
"position": [
1680,
120
],
"alwaysOutputData": true,
"credentials": {
"webflowOAuth2Api": {
"id": "ahjw47cmO7Ygg87A",
"name": "Webflow"
}
}
},
"httpCode": "400",
"description": "400 - {\"msg\":\"Validation Failure\",\"code\":400,\"name\":\"ValidationError\",\"path\":\"/collections/64d6906171b3daae8ef64bd4/items/656f9bf094565a5452ad3c78\",\"err\":\"ValidationError: Validation Failure\",\"problems\":[\"Field '_draft': Field is required\"],\"problem_data\":[{\"slug\":\"_draft\",\"msg\":\"Field is required\",\"value\":null}],\"extensions\":{\"input\":{\"collection_id\":{},\"item_id\":{},\"target\":\"live\",\"mode\":\"live\",\"need_staging\":true,\"need_live\":true,\"need_collections\":false,\"need_staging_draft\":false,\"isPatchMode\":false,\"isSilentMode\":false,\"skipInvalidFiles\":false},\"meta\":{\"authType\":\"oauth_user\",\"userId\":{}}}} - Validation Failure",
"message": "Bad request - please check your parameters",
"stack": "NodeApiError: Bad request - please check your parameters at Object.requestWithAuthentication (/usr/local/lib/node_modules/n8n/packages/core/dist/NodeExecuteFunctions.js:1163:19) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Object.execute (/usr/local/lib/node_modules/n8n/packages/nodes-base/dist/nodes/Webflow/Webflow.node.js:169:40) at Workflow.runNode (/usr/local/lib/node_modules/n8n/packages/workflow/dist/Workflow.js:696:19) at /usr/local/lib/node_modules/n8n/packages/core/dist/WorkflowExecute.js:656:53"
},
"lastNodeExecuted": "W: Update Category",
"mode": "trigger"
},
"workflow": {
"id": "VYoxuNc3PxTtAJzp",
"name": "Sync Categories"
}
}
]
The Error Workflow
What I’d like to do now is take the message from inside of that description, and sync it back to the original record in Notion, so that the person who just made the edit can check and see if an error occurred. Here is the beginning of an Error Workflow that would accomplish that.
No way to complete the Workflow
Unfortunately the error occurred on a Webflow node, at the end of the target workflow. From the Error Workflow context, I don’t have any way of accessing the Notion ID (or any node data) that I need in order to present this error back to the user that entered the data to begin the synchronization process. I even added the Notion ID as a parameter to the Webflow request, but the request parameters don’t make it through to the Error Workflow.
Is there any way to work around this?
Are there any other ingenious methods people have come up with to transmit data from the workflow to the Error Workflow?
Information on your n8n setup
- n8n version: cloud
- Browser: Chromium, Linux