Error Workflow is missing important context

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:

  1. Execute the target workflow, triggering an error.
  2. The error workflow triggers.
  3. Look at the execution snapshot, put the input in JSON mode, copy it.
  4. 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
1 Like

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I discovered the nodes have an “On Error” option which I can set to “Continue (using error output)”. That sounds promising, like I might be able to access all the information I need from this context.

Unfortunately, as you can see in the snapshot below, the error branch outputs a single text property “error: Bad request - please check your parameters”. All of the relevant fields have been stripped from the error message.

So I have the NotionID here, but it’s a no go, as there’s not enough information in the error message body alone for the user to understand what’s happening. I.E. it doesn’t tell them what fields failed validation.

1 Like

On the plus side, I’m really impressed with how you can copy and paste workflows into the discussion like this. What a beautiful thing to aid conversation. And the tool overall is impressive. I see a lot of love put into this. Good job to the whole team there!

Even though I’m pointing out some rough edges here, my overall experience has been positive.

Hey @Brandon_Mason,

You have a very good point there, I think this would make a fantastic feature request and we should probably spend some time looking at the error triggers to see how we can improve it to make life easier. Personally I have been using an approach similar to the error output for the last 2 and a bit years which has been working but it would be a lot easier if everything was in the error event.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.