{"record":{"id":"9302f06f87ff9667","repo":"Zie619/n8n-workflows","slug":"no-status-name-found-for-section-id-sectionid-9302f0","errorCode":null,"errorMessage":"No status name found for section ID '{sectionId}'","messagePattern":"No status name found for section ID '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"workflows/Webhook/1897_Webhook_Filter_Sync_Webhook.json","lineNumber":2963,"sourceCode":"      \"parameters\": {\n        \"width\": 220,\n        \"height\": 300,\n        \"content\": \"## Set Globals\\nUse Sync Setup Helper Workflow to generate the JSON and paste it in every Globals Nodes\"\n      },\n      \"typeVersion\": 1,\n      \"notes\": \"This stickyNote node performs automated tasks as part of the workflow.\"\n    },\n    {\n      \"id\": \"44393b98-739a-4478-a485-67b8bb59e901\",\n      \"name\": \"Map Todoist to Notion1\",\n      \"type\": \"n8n-nodes-base.code\",\n      \"position\": [\n        5620,\n        2760\n      ],\n      \"parameters\": {\n        \"mode\": \"runOnceForEachItem\",\n        \"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 };\"\n      },\n      \"typeVersion\": 2,\n      \"notes\": \"This code node performs automated tasks as part of the workflow.\"\n    },\n    {\n      \"id\": \"9c9bf784-1318-4891-a6d8-3303aa09bd82\",\n      \"name\": \"Get Todoist Task1\",\n      \"type\": \"n8n-nodes-base.todoist\",\n      \"onError\": \"continueErrorOutput\",\n      \"maxTries\": 3,\n      \"position\": [\n        4740,\n        2760\n      ],\n      \"parameters\": {\n        \"taskId\": \"={{ $('Todoist trigger reference').item.json.body.event_data.id }}\",\n        \"operation\": \"get\"\n      },","sourceCodeStart":2945,"sourceCodeEnd":2981,"githubUrl":"https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Webhook/1897_Webhook_Filter_Sync_Webhook.json#L2945-L2981","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm Globals1 targets the same Todoist project as the incoming events and that its sections list is populated (pin and inspect).","Default unknown section IDs to 'Backlog' with a warning rather than failing the sync.","Re-fetch sections when a lookup misses (or on a schedule) so newly created sections are known.","Add Object.keys(sectionMap).length check right after building the map: if 0, throw 'Globals1 sections empty' — a clearer error."],"exampleFix":"// before\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// after\noutput.status = 'Backlog';\nif (sectionId !== null) {\n  const name = sectionMap[sectionId];\n  if (!name) {\n    console.warn(`Unknown Todoist section ID '${sectionId}'; defaulting to Backlog`);\n  } else {\n    output.status = name;\n  }\n}","handlingStrategy":"fallback","validationCode":"const sectionMap = Object.fromEntries(globals.sections.map(s => [s.id, s.name]));\nif (Object.keys(sectionMap).length === 0) {\n  throw new Error('Globals1 returned no Todoist sections — check the project_id and the fetch node.');\n}\noutput.status = 'Backlog';\nif (sectionId !== null && sectionMap[sectionId]) {\n  output.status = sectionMap[sectionId];\n} else if (sectionId !== null) {\n  console.warn(`Unknown section ID '${sectionId}'; defaulting to Backlog`);\n}","typeGuard":"const isKnownSectionId = (id, sections) => sections.some(s => s.id === id);","tryCatchPattern":null,"preventionTips":["Scope Todoist tokens and Globals fetches to a single project so foreign section IDs cannot appear.","Validate that the sections snapshot is non-empty immediately after fetching — an empty map makes every event fail identically.","For frequently-changing projects, re-fetch sections on lookup miss instead of hard-failing the event."],"tags":["n8n","code-node","todoist","notion","webhook","status-mapping","sync"],"backgroundTag":null,"analyzedSha":"94007c1445d9258a7da116646b79473e7c7c3282","analyzedAt":"2026-08-15T04:10:37.591Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}