Zie619/n8n-workflows · warning · Error

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

Error message

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

What it means

Message attributed to 'Map Todoist to Notion', but in the shipped code the throw is COMMENTED OUT: //throw new Error("No status name found for section ID '" + sectionId + "'");. The intent was to fire when a Todoist section_id is absent from globals.sections (id -> name map), but as written an unknown sectionId silently falls through and output.status = sectionMap[sectionId] assigns undefined, which can push 'undefined' as a status to Notion.

Source

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

              "rightValue": "updated_status"
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "notes": "This filter node performs automated tasks as part of the workflow."
    },
    {
      "id": "63990a2a-7380-4799-9037-bd98ed779ddd",
      "name": "Map Todoist to Notion",
      "type": "n8n-nodes-base.code",
      "position": [
        6320,
        720
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const globals = $('Globals').first().json;\nlet eventData = $json.item;\n\nlet output = {};\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\nif ($json.action == \"deleted\") {\n  output.status = \"Obsolete\";\n}\n\n// Format due date\noutput.due = eventData.due ? eventData.due.date : eventData.due_datetime || \"\"\n\nreturn { json: output };"
      },
      "typeVersion": 2,
      "notes": "This code node performs automated tasks as part of the workflow."
    },
    {
      "id": "a5f3a1ed-1a97-441e-afbc-604b5011928e",
      "name": "Map summary fields",
      "type": "n8n-nodes-base.set",
      "position": [
        6540,
        720
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e0fcdd39-1bd8-44e7-b84f-0b6ba834fb46",

View on GitHub (pinned to 94007c1445)

Solutions

  1. Decide the policy: either re-enable the throw, or keep a fallback — but do not leave sectionMap[sectionId] assigning undefined.
  2. Recommended: default to 'Backlog' and log a warning for unknown section IDs.
  3. Verify the Globals node fetches sections from the same Todoist project the tasks belong to.
  4. Audit recently synced Notion rows for status 'undefined' / empty and repair them.

Example fix

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

// after - explicit, non-destructive policy
output.status = 'Backlog';
if (sectionId !== null) {
  const name = sectionMap[sectionId];
  if (!name) {
    console.warn(`Unknown Todoist section ID ${sectionId}; defaulting status 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]));
output.status = 'Backlog';
if (sectionId !== null) {
  const name = sectionMap[sectionId];
  if (!name) {
    console.warn(`Unknown section ID ${sectionId}; defaulting to Backlog`);
  } else {
    output.status = name;
  }
}

Type guard

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

Prevention

When it happens

Trigger: A Todoist task whose section_id belongs to another project or a deleted section, globals.sections fetched from a different Todoist project, or a section created after the Globals node ran. None of these throw — they produce an undefined status instead (the bug is the silent path, not the error).

Common situations: Someone disabled the guard to stop sync failures, leaving hidden data corruption; multi-project Todoist setups where IDs cross projects; stale globals across long-running executions.

Related errors


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