Zie619/n8n-workflows · error · Error

No status name found for section ID '{sectionId}'

Error message

No status name found for section ID '{sectionId}'

What it means

Thrown by 'Map Todoist to Notion1' (runOnceForEachItem, reverse direction: Todoist -> Notion) when eventData.section_id from the Todoist payload is not present in the id->name map built from Globals1.sections. Unlike its sibling (error 115) the throw here is ACTIVE, so an unknown section ID hard-fails the item.

Source

Thrown at workflows/Webhook/1897_Webhook_Filter_Sync_Webhook.json:2963

      "parameters": {
        "width": 220,
        "height": 300,
        "content": "## Set Globals\nUse Sync Setup Helper Workflow to generate the JSON and paste it in every Globals Nodes"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "44393b98-739a-4478-a485-67b8bb59e901",
      "name": "Map Todoist to Notion1",
      "type": "n8n-nodes-base.code",
      "position": [
        5620,
        2760
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const globals = $('Globals1').first().json;\nlet eventData = $json;\n\nlet output = {};\n\noutput.todoist_id = eventData.id;\n\noutput.name = eventData.content\n\n// Map priority\noutput.priority = {\n  \"4\": \"do first\", // P1\n  \"3\": \"urgent\", // P2\n  \"2\": \"important\" // P3\n}[eventData.priority] ?? \"\"; // P4\n\n// Map section\nconst sectionId = eventData.section_id;\nconst sectionMap = Object.fromEntries(\n    globals.sections.map(section => [section.id, section.name])\n);\n\noutput.status = \"Backlog\";\nif (sectionId !== null) {\n  if (!sectionMap.hasOwnProperty(sectionId)) {\n    throw new Error(\"No status name found for section ID '\" + sectionId + \"'\");\n  }\n  output.status = sectionMap[sectionId];\n}\n\n// Since there is no Done section in Todoist, override status if completed\nif (eventData.is_completed) {\n  output.status = \"Done\";\n}\n\n// Map date and time\noutput.due = null;\nif (eventData.due !== null) {\n  output.due = eventData.due.date\n  if (eventData.due.datetime !== undefined) {\n    output.due = eventData.due.datetime\n  }\n}\n\nreturn { json: output };"
      },
      "typeVersion": 2,
      "notes": "This code node performs automated tasks as part of the workflow."
    },
    {
      "id": "9c9bf784-1318-4891-a6d8-3303aa09bd82",
      "name": "Get Todoist Task1",
      "type": "n8n-nodes-base.todoist",
      "onError": "continueErrorOutput",
      "maxTries": 3,
      "position": [
        4740,
        2760
      ],
      "parameters": {
        "taskId": "={{ $('Todoist trigger reference').item.json.body.event_data.id }}",
        "operation": "get"
      },

View on GitHub (pinned to 94007c1445)

Solutions

  1. Confirm Globals1 targets the same Todoist project as the incoming events and that its sections list is populated (pin and inspect).
  2. Default unknown section IDs to 'Backlog' with a warning rather than failing the sync.
  3. Re-fetch sections when a lookup misses (or on a schedule) so newly created sections are known.
  4. Add Object.keys(sectionMap).length check right after building the map: if 0, throw 'Globals1 sections empty' — a clearer error.

Example fix

// before
if (sectionId !== null) {
  if (!sectionMap.hasOwnProperty(sectionId)) {
    throw new Error("No status name found for section ID '" + sectionId + "'");
  }
  output.status = sectionMap[sectionId];
}

// after
output.status = 'Backlog';
if (sectionId !== null) {
  const name = sectionMap[sectionId];
  if (!name) {
    console.warn(`Unknown Todoist section ID '${sectionId}'; defaulting to Backlog`);
  } else {
    output.status = name;
  }
}
Defensive patterns

Strategy: fallback

Validate before calling

const sectionMap = Object.fromEntries(globals.sections.map(s => [s.id, s.name]));
if (Object.keys(sectionMap).length === 0) {
  throw new Error('Globals1 returned no Todoist sections — check the project_id and the fetch node.');
}
output.status = 'Backlog';
if (sectionId !== null && sectionMap[sectionId]) {
  output.status = sectionMap[sectionId];
} else if (sectionId !== null) {
  console.warn(`Unknown section ID '${sectionId}'; defaulting to Backlog`);
}

Type guard

const isKnownSectionId = (id, sections) => sections.some(s => s.id === id);

Prevention

When it happens

Trigger: Todoist sends a task whose section belongs to a different project than Globals1 fetched from; the section was deleted after Globals1 cached the list; a new section was created between the Globals fetch and this event; or Globals1 errored/returned an empty sections array so every lookup fails.

Common situations: Multi-project Todoist tokens, webhooks delivering events for tasks moved between projects, race conditions on freshly created sections, or the Globals1 HTTP call silently failing (continue-on-error) leaving sections empty.

Related errors


AI-assisted analysis of Zie619/n8n-workflows@94007c1445 (2026-08-15). Data as JSON: /api/errors/9302f06f87ff9667. Report an issue: GitHub.