{
  "name": "Ops — Error Handler (Generative Z)",
  "nodes": [
    {
      "parameters": {},
      "id": "122b279c-b181-4f31-8243-31c24cfcbb62",
      "name": "On Workflow Error",
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [
        0,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// Error workflow: no payloads, no secrets — just what is needed to act.\nconst e = $input.first().json;\nconst wf = e.workflow || {};\nconst ex = e.execution || {};\nconst err = ex.error || {};\nconst body = [\n  `Workflow: ${wf.name || 'unknown'}`,\n  `Execution: ${ex.id || 'n/a'}`,\n  `Failed node: ${ex.lastNodeExecuted || 'n/a'}`,\n  `Mode: ${ex.mode || 'n/a'}`,\n  `Time: ${new Date().toISOString()}`,\n  `Error: ${String(err.message || 'n/a').slice(0, 300)}`,\n  ex.url ? `Open: ${ex.url}` : '',\n].filter(Boolean).join('\\n');\nreturn [{ json: { subject: `🔴 n8n failure — ${wf.name || 'workflow'}`, text: body } }];\n"
      },
      "id": "7998bce8-bc85-4b4d-930c-ab5ac3e9ef37",
      "name": "Format Error Summary",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        220,
        300
      ]
    },
    {
      "parameters": {
        "fromEmail": "REPLACE_ME@generativez.es",
        "toEmail": "REPLACE_ME@generativez.es",
        "subject": "={{ $json.subject }}",
        "emailFormat": "text",
        "text": "={{ $json.text }}",
        "options": {}
      },
      "id": "841aa24c-7fe7-4d05-8f95-67a813073243",
      "name": "Email Ops Team",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        440,
        300
      ]
    }
  ],
  "connections": {
    "On Workflow Error": {
      "main": [
        [
          {
            "node": "Format Error Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Error Summary": {
      "main": [
        [
          {
            "node": "Email Ops Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "tags": []
}