Duplicating a workflow

Describe the problem/error/question

I’m trying to duplicate a workflow. After the trigger I’m scheduling “get workflow” > “create workflow”.

I’m getting the required workflow in json format, but when I try to pass the “nodes” parameter it throws an error.

I’m not great at programming or manipulating json—any help is greatly appreciated!

What is the error message (if any)?

The ‘workflowObject’ property must be valid JSON, but cannot be parsed

Please share your workflow

Share the output returned by the last node

{
  "errorMessage": "The 'workflowObject' property must be valid JSON, but cannot be parsed",
  "errorDetails": {
    "rawErrorMessage": [
      "The 'workflowObject' property must be valid JSON, but cannot be parsed"
    ],
    "httpCode": "none"
  },
  "n8nDetails": {
    "nodeName": "n8n1",
    "nodeType": "n8n-nodes-base.n8n",
    "nodeVersion": 1,
    "resource": "workflow",
    "operation": "create",
    "itemIndex": 0,
    "runIndex": 0,
    "time": "4/14/2024, 4:04:20 PM",
    "n8nVersion": "1.34.2 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "NodeApiError: The 'workflowObject' property must be valid JSON, but cannot be parsed",
      "    at RoutingNode.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/RoutingNode.js:121:23)",
      "    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:774: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"
    ]
  }
}

Information on your n8n setup

  • n8n version: 1.34.2
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 22.04.4 LTS x86_64

hello @bean

That’s the correct syntax

{ "name": "[[email protected]] - [Test search]", "nodes": {{ JSON.stringify($json.nodes) }} , "connections": {}, "settings": {} } 
2 Likes

thanks @barn4k! you rock <3

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