{"record":{"id":"e0910a470237a3df","repo":"Zie619/n8n-workflows","slug":"no-status-name-found-for-section-id-sectionid","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":"warning","filePath":"workflows/Webhook/1897_Webhook_Filter_Sync_Webhook.json","lineNumber":1542,"sourceCode":"              \"rightValue\": \"updated_status\"\n            }\n          ]\n        }\n      },\n      \"typeVersion\": 2.2,\n      \"notes\": \"This filter node performs automated tasks as part of the workflow.\"\n    },\n    {\n      \"id\": \"63990a2a-7380-4799-9037-bd98ed779ddd\",\n      \"name\": \"Map Todoist to Notion\",\n      \"type\": \"n8n-nodes-base.code\",\n      \"position\": [\n        6320,\n        720\n      ],\n      \"parameters\": {\n        \"mode\": \"runOnceForEachItem\",\n        \"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 };\"\n      },\n      \"typeVersion\": 2,\n      \"notes\": \"This code node performs automated tasks as part of the workflow.\"\n    },\n    {\n      \"id\": \"a5f3a1ed-1a97-441e-afbc-604b5011928e\",\n      \"name\": \"Map summary fields\",\n      \"type\": \"n8n-nodes-base.set\",\n      \"position\": [\n        6540,\n        720\n      ],\n      \"parameters\": {\n        \"options\": {},\n        \"assignments\": {\n          \"assignments\": [\n            {\n              \"id\": \"e0fcdd39-1bd8-44e7-b84f-0b6ba834fb46\",","sourceCodeStart":1524,"sourceCodeEnd":1560,"githubUrl":"https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Webhook/1897_Webhook_Filter_Sync_Webhook.json#L1524-L1560","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Decide the policy: either re-enable the throw, or keep a fallback — but do not leave sectionMap[sectionId] assigning undefined.","Recommended: default to 'Backlog' and log a warning for unknown section IDs.","Verify the Globals node fetches sections from the same Todoist project the tasks belong to.","Audit recently synced Notion rows for status 'undefined' / empty and repair them."],"exampleFix":"// before (silent fallthrough)\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]; // undefined for unknown IDs\n}\n\n// after - explicit, non-destructive policy\noutput.status = 'Backlog';\nif (sectionId !== null) {\n  const name = sectionMap[sectionId];\n  if (!name) {\n    console.warn(`Unknown Todoist section ID ${sectionId}; defaulting status 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]));\noutput.status = 'Backlog';\nif (sectionId !== null) {\n  const name = sectionMap[sectionId];\n  if (!name) {\n    console.warn(`Unknown section ID ${sectionId}; defaulting to Backlog`);\n  } else {\n    output.status = name;\n  }\n}","typeGuard":"const isKnownSectionId = (id, sections) =>\n  sections.some(s => s.id === id);","tryCatchPattern":null,"preventionTips":["Never comment out a validation throw without replacing it with an explicit fallback — silent undefined assignments corrupt downstream data.","Search synced Notion records for status 'undefined'/empty to find damage already done by the disabled guard.","Log every fallback so unknown sections are visible in execution logs even when the workflow succeeds."],"tags":["n8n","code-node","todoist","notion","silent-failure","disabled-guard","data-corruption"],"backgroundTag":null,"analyzedSha":"94007c1445d9258a7da116646b79473e7c7c3282","analyzedAt":"2026-08-15T04:10:37.591Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}