{"record":{"id":"f171fb5aa4126b44","repo":"Zie619/n8n-workflows","slug":"no-todoist-section-found-for-status-statusname-f171fb","errorCode":null,"errorMessage":"No Todoist section found for status '{statusName}'","messagePattern":"No Todoist section found for status '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"workflows/Webhook/1897_Webhook_Filter_Sync_Webhook.json","lineNumber":2379,"sourceCode":"        \"todoistApi\": {\n          \"id\": \"Dp3VoWGH5IhrK22k\",\n          \"name\": \"Todoist (mario.haarmann)\"\n        }\n      },\n      \"typeVersion\": 4.2,\n      \"notes\": \"This httpRequest node performs automated tasks as part of the workflow.\"\n    },\n    {\n      \"id\": \"20d2cdc2-92ca-497d-a606-445ecf52e908\",\n      \"name\": \"Get Backlog Section ID\",\n      \"type\": \"n8n-nodes-base.code\",\n      \"position\": [\n        7200,\n        2440\n      ],\n      \"parameters\": {\n        \"mode\": \"runOnceForEachItem\",\n        \"jsCode\": \"const globals = $('Globals1').first().json;\\n\\nlet output = {};\\n\\nconst statusName = $('Map Todoist to Notion1').item.json.status;\\nconst sectionMap = Object.fromEntries(\\n    globals.sections.map(section => [section.name, section.id])\\n);\\nif (!sectionMap.hasOwnProperty(statusName)) {\\n    throw new Error(\\\"No Todoist section found for status '\\\" + statusName + \\\"'\\\");\\n}\\noutput.section_id = sectionMap[statusName];\\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\": \"72819157-59db-4a4e-ad13-1bf73c583be7\",\n      \"name\": \"Notion Task not found\",\n      \"type\": \"n8n-nodes-base.if\",\n      \"position\": [\n        6280,\n        2760\n      ],\n      \"parameters\": {\n        \"options\": {},\n        \"conditions\": {\n          \"options\": {\n            \"version\": 2,\n            \"leftValue\": \"\",","sourceCodeStart":2361,"sourceCodeEnd":2397,"githubUrl":"https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Webhook/1897_Webhook_Filter_Sync_Webhook.json#L2361-L2397","documentation":"Thrown by 'Get Backlog Section ID' (runOnceForEachItem) when the status produced by $('Map Todoist to Notion1').item.json.status has no entry in the name->id sectionMap built from Globals1.sections. It resolves a Notion-bound status back to a Todoist section_id for the update call; any status string that is not an exact Todoist section name fails.","triggerScenarios":"Map Todoist to Notion1 emitted its default 'Backlog' (used when section_id is null or unknown) while the Todoist project has no section literally named 'Backlog'; a status set from is_completed ('Done') or action=='deleted' ('Obsolete') that has no same-named Todoist section; renamed sections on either side.","commonSituations":"The Todoist project uses different section names than the Notion status options (e.g., 'To Do' vs 'Backlog'); Done/Obsolete reached this branch even though other mappers exempt them; Globals1 fetched from the wrong project.","solutions":["Ensure a Todoist section named 'Backlog' exists (or change the default in Map Todoist to Notion1 to a section that does exist).","Exempt 'Done'/'Obsolete' here too, or create matching sections for them, since this node only needs a section for open tasks.","Print the known section names in the error: Object.keys(sectionMap).join(', ').","Verify Globals1's project_id matches the project being written to."],"exampleFix":"// before\nif (!sectionMap.hasOwnProperty(statusName)) {\n    throw new Error(\"No Todoist section found for status '\" + statusName + \"'\");\n}\noutput.section_id = sectionMap[statusName];\n\n// after - done/obsolete need no section; unknown falls back to Backlog\nif (['Done', 'Obsolete'].includes(statusName)) {\n  return { json: { section_id: null } };\n}\nlet sectionId = sectionMap[statusName];\nif (!sectionId) {\n  console.warn(`No section for status '${statusName}'; known: ${Object.keys(sectionMap).join(', ')}`);\n  sectionId = sectionMap['Backlog'] ?? null;\n}\nreturn { json: { section_id: sectionId } };","handlingStrategy":"validation","validationCode":"if (['Done', 'Obsolete'].includes(statusName)) {\n  return { json: { section_id: null } };\n}\nconst id = sectionMap[statusName] ?? sectionMap['Backlog'];\nif (!id) {\n  throw new Error(`No section for '${statusName}'. Known: ${Object.keys(sectionMap).join(', ')}`);\n}\nreturn { json: { section_id: id } };","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure a literal 'Backlog' section exists in the Todoist project if the code uses it as the default status name.","Exempt terminal statuses (Done/Obsolete) from section resolution — they need no section in Todoist.","Make defaults consistent across all mapper copies: one default status name, one fallback policy."],"tags":["n8n","code-node","todoist","notion","status-mapping","section-id"],"backgroundTag":null,"analyzedSha":"94007c1445d9258a7da116646b79473e7c7c3282","analyzedAt":"2026-08-15T04:10:37.591Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}