N8n node - create workflow action item - json parsing error

Describe the problem/error/question

I am trying to restore backup workflows as I moved cloud solutions. So, my use case is - a) Access Github and get a list of the workflows stored as backup.
b) Use n8n node to create these workflows on the n8n instance hosted on coolify hosted on hostinger.
I tried following options-
a) Github → convert the file to json → n8n node(create workflow action)
b) Github → convert the file to json → code node(to try to reformat string/json) → n8n node(create workflow action)

c) I’ve also tried API testing via n8n docs and i am able to create the dummy workflow via the api successfully. This isolates the issue as not being connectivity but the json parsing.

keep hitting the error - The ‘workflowObject’ property must be valid JSON, but cannot be parsed

I came across issue #16377 (issues on n8n github) which is marked as closed but I dont see feedback, so I tried the listed minimal workflow and i hit the error listed in the mentioned issue with the minimal listed workflow as well.
minimal workflow -
{
“name”: “Minimal Diagnostic Test Workflow”,
“nodes”: [
{
“parameters”: {},
“name”: “Start”,
“type”: “n8n-nodes-base.start”,
“typeVersion”: 1,
“position”: [ 250, 250 ],
“id”: “a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6”
}
],
“connections”: {},
“settings”: {}
}

error - The resource you are requesting could not be found
I was wondering if there was an actual fix implemented?

What is the error message (if any)?

keep hitting the error - The ‘workflowObject’ property must be valid JSON, but cannot be parsed

Please share your workflow

{
  "nodes": [
    {
      "parameters": {
        "operation": "create",
        "workflowObject": "={{ $node[\"Code in JavaScript\"].json.workflowObject }}\n",
        "requestOptions": {}
      },
      "type": "n8n-nodes-base.n8n",
      "typeVersion": 1,
      "position": [
        2064,
        256
      ],
      "id": "ed77bb08-97bd-45da-a200-e856b0438b44",
      "name": "Create a workflow",
      "credentials": {
        "n8nApi": {
          "id": "l0nZPWuK5jNTnSYS",
          "name": "n8n account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Code node: Clean up workflowObject strictly\n\nconst allItems = $input.all();\n\nif (allItems.length === 0) {\n  throw new Error(\"No input items to transform\");\n}\n\nconst raw = allItems[0].json;\nconst w = raw.data ? raw.data : raw;\n\n// Helper to check if an object has any own‑properties\nfunction hasOwnProperties(obj) {\n  if (typeof obj !== 'object' || obj === null) return false;\n  return Object.keys(obj).length > 0;\n}\n\n// Build minimal workflowObject\nconst workflowObject = {\n  name: w.name,\n  nodes: w.nodes,\n  connections: w.connections,\n  settings: w.settings && hasOwnProperties(w.settings) ? w.settings : {},\n};\n\n// Optionally include extras only if valid\nif (Array.isArray(w.tags) && w.tags.length > 0) {\n  workflowObject.tags = w.tags;\n}\n\nif (w.versionId && typeof w.versionId === 'string' && w.versionId.trim() !== '') {\n  workflowObject.versionId = w.versionId;\n}\n\nif (w.shared && Array.isArray(w.shared) && w.shared.length > 0) {\n  workflowObject.shared = w.shared;\n}\n\nif (w.meta && typeof w.meta === 'object' && hasOwnProperties(w.meta)) {\n  workflowObject.meta = w.meta;\n}\n\nif (typeof w.active === 'boolean') {\n  workflowObject.active = w.active;\n}\n\nif (w.createdAt && typeof w.createdAt === 'string' && w.createdAt.trim() !== '') {\n  workflowObject.createdAt = w.createdAt;\n}\n\nif (w.updatedAt && typeof w.updatedAt === 'string' && w.updatedAt.trim() !== '') {\n  workflowObject.updatedAt = w.updatedAt;\n}\n\nif (w.pinData && typeof w.pinData === 'object' && hasOwnProperties(w.pinData)) {\n  workflowObject.pinData = w.pinData;\n}\n\n// Also clean nodes: remove internal metadata that might break schema\nworkflowObject.nodes = workflowObject.nodes.map(node => {\n  const cleaned = { ...node };\n\n  // Remove fields starting with \"__rl\" or internal metadata\n  if (cleaned.parameters) {\n    // deep clean parameters if required\n    // But for simplicity, remove any \"__rl\" keys in node\n    delete cleaned.parameters.__rl;\n    // possibly also delete cached URLs etc\n  }\n\n  return cleaned;\n});\n\n// Return\nreturn [\n  {\n    json: {\n      workflowObject\n    }\n  }\n];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1776,
        352
      ],
      "id": "efe51dca-481c-4d0f-a315-353f7a81099a",
      "name": "Code in JavaScript"
    }
  ],
  "connections": {
    "Create a workflow": {
      "main": [
        []
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Create a workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateId": "3096",
    "templateCredsSetupCompleted": true,
    "instanceId": "e8c092e78bd9874dd52a3b93b95046584d8b8f605b7c62825016c2239589947d"
  }
}(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

input expression in n8n node - {{ $node["Code in JavaScript"].json.workflowObject }}. output is error due to [object Object] returned

Information on your n8n setup

  • n8n version: 1.110.1

  • Database (default: SQLite): NA

  • n8n EXECUTIONS_PROCESS setting (default: own, main): trigger node

  • Running n8n via (Docker, npm, n8n cloud, desktop app): running workflow on n8n hosted on coolify hosted on hostinger.

  • Operating system: coolify

  • Debug info

    core

    • n8nVersion: 1.110.1
    • platform: docker (self-hosted)
    • nodeJsVersion: 22.19.0
    • database: sqlite
    • executionMode: regular
    • concurrency: -1
    • license: enterprise (production)
    • storage

    • success: all
    • error: all
    • progress: false
    • manual: true
    • binaryMode: memory

    pruning

    • enabled: true
    • maxAge: 336 hours
    • maxCount: 10000 executions

    client

    • userAgent: mozilla/5.0 (macintosh; intel mac os x 10_15_7) applewebkit/537.36 (khtml, like gecko) chrome/139.0.0.0 safari/537.36
    • isTouchDevice: false

    security

    • secureCookie: false

    Generated at: 2025-09-15T02:45:01.961Z

Hey @Ash_yadav hope all is good.

Try this, maybe this will help or give you an idea:

The top flow is for saving the WF to GH
The bottom is to load it back and create a new WF

@jabbson Thanks for the prompt response!

I thought you were a bot (your name popped with AI in the end lol) sorry about that.

There definitely is an issue with n8n create workflow node. I used object as well as stringify option from the code node to feed into n8n create workflow node.

  1. If the output workflow from code node is fed as an object into the n8n create workflow node - I hit json parse error mentioned earlier

  2. if i use stringify to pass that object as string into n8n create workflow node - I hit NodeApiError: The resource you are requesting could not be found

However, if I copy the stringify output as it is and use the API docs test tool on API reference | n8n Docs - the workflow gets created successfully. Hence something needs to be fixed in the backend.

node api error details (seems like local vs hosted is causing it to break)-i hit the error - NodeApiError: The resource you are requesting could not be found at ExecuteSingleContext.httpRequestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_5aee33ef851c7de341eb325c6a25e0ff/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:1365:9) at processTicksAndRejections (node:internal/process/task_queues:105:5) at ExecuteSingleContext.httpRequestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_5aee33ef851c7de341eb325c6a25e0ff/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:1737:11) at RoutingNode.rawRoutingRequest (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_5aee33ef851c7de341eb325c6a25e0ff/node_modules/n8n-core/src/execution-engine/routing-node.ts:531:20) at RoutingNode.makeRequest (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_5aee33ef851c7de341eb325c6a25e0ff/node_modules/n8n-core/src/execution-engine/routing-node.ts:725:19) at async Promise.allSettled (index 0) at RoutingNode.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_5aee33ef851c7de341eb325c6a25e0ff/node_modules/n8n-core/src/execution-engine/routing-node.ts:234:29) at ExecuteContext.versionedNodeType.execute (/usr/local/lib/node_modules/n8n/src/node-types.ts:60:18) at WorkflowExecute.executeNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_5aee33ef851c7de341eb325c6a25e0ff/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1254:8) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_5aee33ef851c7de341eb325c6a25e0ff/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1428:11)

github issue has been created for this - Issue id #16377 related - n8n node throwing error when trying to create a workflow · Issue #19530 · n8n-io/n8n · GitHub

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