Zie619/n8n-workflows · error · Error

No Todoist section found for status '{statusName}'

Error message

No Todoist section found for status '{statusName}'

What it means

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.

Source

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

        "todoistApi": {
          "id": "Dp3VoWGH5IhrK22k",
          "name": "Todoist (mario.haarmann)"
        }
      },
      "typeVersion": 4.2,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "20d2cdc2-92ca-497d-a606-445ecf52e908",
      "name": "Get Backlog Section ID",
      "type": "n8n-nodes-base.code",
      "position": [
        7200,
        2440
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "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 };"
      },
      "typeVersion": 2,
      "notes": "This code node performs automated tasks as part of the workflow."
    },
    {
      "id": "72819157-59db-4a4e-ad13-1bf73c583be7",
      "name": "Notion Task not found",
      "type": "n8n-nodes-base.if",
      "position": [
        6280,
        2760
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",

View on GitHub (pinned to 94007c1445)

Solutions

  1. Ensure a Todoist section named 'Backlog' exists (or change the default in Map Todoist to Notion1 to a section that does exist).
  2. Exempt 'Done'/'Obsolete' here too, or create matching sections for them, since this node only needs a section for open tasks.
  3. Print the known section names in the error: Object.keys(sectionMap).join(', ').
  4. Verify Globals1's project_id matches the project being written to.

Example fix

// before
if (!sectionMap.hasOwnProperty(statusName)) {
    throw new Error("No Todoist section found for status '" + statusName + "'");
}
output.section_id = sectionMap[statusName];

// after - done/obsolete need no section; unknown falls back to Backlog
if (['Done', 'Obsolete'].includes(statusName)) {
  return { json: { section_id: null } };
}
let sectionId = sectionMap[statusName];
if (!sectionId) {
  console.warn(`No section for status '${statusName}'; known: ${Object.keys(sectionMap).join(', ')}`);
  sectionId = sectionMap['Backlog'] ?? null;
}
return { json: { section_id: sectionId } };
Defensive patterns

Strategy: validation

Validate before calling

if (['Done', 'Obsolete'].includes(statusName)) {
  return { json: { section_id: null } };
}
const id = sectionMap[statusName] ?? sectionMap['Backlog'];
if (!id) {
  throw new Error(`No section for '${statusName}'. Known: ${Object.keys(sectionMap).join(', ')}`);
}
return { json: { section_id: id } };

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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