{
  "name": "n8n 2.x upgrade pre-check",
  "nodes": [
    {
      "id": "b1f0c2a4-0001-4c3e-9a10-000000000001",
      "name": "Run the check",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "b1f0c2a4-0001-4c3e-9a10-000000000002",
      "name": "Get all workflows",
      "type": "n8n-nodes-base.n8n",
      "typeVersion": 1,
      "position": [
        260,
        0
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      }
    },
    {
      "id": "b1f0c2a4-0001-4c3e-9a10-000000000003",
      "name": "Find 2.x breaking changes",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        520,
        0
      ],
      "parameters": {
        "jsCode": "// Scans every workflow for the n8n 2.x changes that broke our test workflows.\nconst checks = [\n  { test: (n, p) => n.type === 'n8n-nodes-base.start',\n    issue: 'Start node (removed in 2.0)',\n    fix: 'Replace with Manual Trigger, or with Execute Workflow Trigger if another workflow calls this one, then publish it.' },\n  { test: (n, p) => /\\$env\\b|process\\.env/.test(p),\n    issue: 'Reads environment variables ($env)',\n    fix: 'Blocked by default in 2.x, in Code nodes and in expressions. Move the value into a credential, or set N8N_BLOCK_ENV_ACCESS_IN_NODE=false.' },\n  { test: (n, p) => n.type === 'n8n-nodes-base.code' && /\\$evaluateExpression/.test(p),\n    issue: 'Code node uses $evaluateExpression',\n    fix: 'Fails on 2.x task runners. Compute the value in an Edit Fields (Set) node before the Code node.' },\n  { test: (n, p) => n.type === 'n8n-nodes-base.code' && (n.parameters.language === 'python' || 'pythonCode' in n.parameters),\n    issue: 'Python Code node (old Pyodide version)',\n    fix: 'Needs an external Python task runner on 2.x. Rewrite in JavaScript if you can.' },\n  { test: (n, p) => ['n8n-nodes-base.executeCommand', 'n8n-nodes-base.localFileTrigger'].includes(n.type),\n    issue: 'Execute Command / Local File Trigger node',\n    fix: 'Disabled by default in 2.x. Allow it with NODES_EXCLUDE=\"[]\" only if you need it.' },\n  { test: (n, p) => /readWriteFile|readBinaryFile|writeBinaryFile/.test(n.type),\n    issue: 'Reads or writes files on the server',\n    fix: 'Only ~/.n8n-files is allowed by default in 2.x. Move the files there or set N8N_RESTRICT_FILE_ACCESS_TO.' },\n  { test: (n, p) => /spontit|crowdDev|kitemaker|automizy/i.test(n.type),\n    issue: 'Node for a retired service (removed in 2.0)',\n    fix: 'Remove the node or replace the service.' },\n];\nconst out = [];\nfor (const item of $input.all()) {\n  const wf = item.json;\n  if (wf.id === $workflow.id) continue; // skip this checker\n  for (const node of wf.nodes || []) {\n    if (node.disabled) continue;\n    const p = JSON.stringify(node.parameters || {});\n    if (p.includes('Scans every workflow for the n8n 2.x changes')) continue; // skip copies of this checker\n    for (const c of checks) {\n      if (c.test(node, p)) {\n        out.push({ json: { workflow: wf.name, workflow_id: wf.id, active: wf.active, node: node.name, issue: c.issue, fix: c.fix } });\n      }\n    }\n  }\n}\nif (!out.length) return [{ json: { result: 'No known 2.x breaking patterns found. Still run Settings > Migration Report.' } }];\nreturn out;\n"
      }
    },
    {
      "id": "b1f0c2a4-0001-4c3e-9a10-000000000004",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -40,
        -300
      ],
      "parameters": {
        "width": 760,
        "height": 240,
        "content": "## n8n 2.x upgrade pre-check (The Automated Shop)\nRun this on your 1.x instance before you upgrade.\n1. Settings > n8n API: create an API key.\n2. Open **Get all workflows** and add an n8n API credential: the key, plus your instance URL ending in /api/v1.\n3. Click **Execute workflow**. Each output row is a workflow with a pattern that broke in our 1.123.101 to 2.49.6 test, plus the fix.\nIt also catches $env use, which the built-in Migration Report missed in our test. Run Settings > Migration Report as well."
      }
    }
  ],
  "connections": {
    "Run the check": {
      "main": [
        [
          {
            "node": "Get all workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all workflows": {
      "main": [
        [
          {
            "node": "Find 2.x breaking changes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}