How to set default “Error Workflow” for new workflows

Hi!

I am iterating your workflow @dkindlund in order to modify the error workflow using the n8n API instead of directly accessing the database, here would be it:

However, it throws an error while updating the workflow: request/body/settings must NOT have additional properties.

Complete error details
{
  "errorMessage": "Bad request - please check your parameters [item 0]",
  "errorDescription": "request/body/settings must NOT have additional properties",
  "errorDetails": {
    "rawErrorMessage": [
      "Request failed with status code 400"
    ],
    "httpCode": "400",
    "errorData": {
      "message": "request/body/settings must NOT have additional properties"
    }
  },
  "n8nDetails": {
    "nodeName": "Update workflow",
    "nodeType": "n8n-nodes-base.n8n",
    "nodeVersion": 1,
    "resource": "workflow",
    "operation": "update",
    "itemIndex": 0,
    "runIndex": 0,
    "time": "24/05/2024, 08:30:02",
    "n8nVersion": "1.40.0 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "NodeApiError: Bad request - please check your parameters",
      "    at Object.httpRequestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1164:15)",
      "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
      "    at Object.httpRequestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1984:20)",
      "    at RoutingNode.rawRoutingRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/RoutingNode.js:285:29)",
      "    at RoutingNode.makeRoutingRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/RoutingNode.js:371:28)",
      "    at RoutingNode.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/RoutingNode.js:104:32)",
      "    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:778:23)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:660:53",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1062:20"
    ]
  }
}

Have you faced the same problem (and that was the reason to directly modify the workflow in the database)?

I have searched a little bit about the error but I still not get why it is not working.
There is another related bug report, but in that case updating the executionOrder setting instead of the errorWorkflow.
The related error required a fix that got released with n8n 1.37.0, and if we take a look to the fix implementation, it references the schema/workflowSettings.yml which already included the errorWorkflow property.

However, it is also true that there are no errorWorkflow being specified in the n8n API workflow update test case, so I don’t really think that having the errorWorkflow in the workflowSettings schema guarantees that it is supported while updating workflows, or it is just that I am doing something wrong :sweat_smile:

Anyone could confirm if I am missing anything or it is an actual bug? :pray::grimacing:

Thanks! :blush:

Edit: I have found this other post from @Jon stating that the errorWorkflow option is already supported for WorkflowSettings in the API, so I guess I am missing something here :S