n8n-io/n8n · warning
SDK_REPEATED_BRANCH_WIRING
SDK_REPEATED_BRANCH_WIRING
Error message
Repeated `.${method}()` (${info.count} times) — each call overwrites the previous target. Wire once on the workflow builder chain. What it means
A source-lint diagnostic (code SDK_REPEATED_BRANCH_WIRING). The linter records each call to a branch method (.onTrue/.onFalse/.onCase) keyed by `${receiverName}.${method}`, then flags any key with count >= 2. In the SDK builder each such call overwrites the previous target on the same node variable instead of merging, so the earlier wiring is silently dropped.
Source
Thrown at packages/@n8n/workflow-sdk/src/lint/sdk/workflow-sdk-lint.ts:355
...locationOf(call),
lintTarget: 'sdk',
}),
);
}
}
}
}
}
},
{ skipChildren: isEmbeddedCodePropertyValue },
);
for (const [key, info] of branchCounts) {
if (info.count < 2) continue;
const [, method] = key.split('.');
issues.push(
lintIssue({
code: 'SDK_REPEATED_BRANCH_WIRING',
message:
`Repeated \`.${method}()\` (${info.count} times) — each call overwrites the previous target. ` +
'Wire once on the workflow builder chain.',
line: info.line,
column: info.column,
lintTarget: 'sdk',
}),
);
}
return dedupeSourceLintIssues(issues);
}
/**
* Lint workflow SDK builder source. Skips jsCode / pythonCode property values.
*/
export function lintWorkflowSdkSource(source: string): SourceLintIssue[] {
const { code, asConstMatches } = prepareSourceForLint(source);View on GitHub (pinned to 5ac6606e81)
Solutions
- Collapse the repeated calls into a single fluent chain: ifNode.onTrue(a).onFalse(b).
- Use the workflow() builder chain (workflow().add(if).onTrue(a)...) which the linter treats as non-overwriting.
- Delete the duplicate call so each branch method is invoked once per node variable.
Example fix
// before
const ifNode = node('n8n-nodes-base.if', 'v1', { ... });
ifNode.onTrue(trueHandler);
ifNode.onTrue(otherHandler); // overwrites
// after
const ifNode = node('n8n-nodes-base.if', 'v1', { ... });
ifNode.onTrue(trueHandler).onFalse(falseHandler); Defensive patterns
Strategy: validation
Validate before calling
import { lintWorkflowSdkSource } from '@n8n/workflow-sdk/lint';
const issues = lintWorkflowSdkSource(workflowSource);
const repeats = issues.filter((i) => i.code === 'SDK_REPEATED_BRANCH_WIRING');
if (repeats.length) {
throw new Error(`Repeated branch wiring: ${JSON.stringify(repeats)}`);
} Prevention
- Prefer a single fluent chain (ifNode.onTrue(a).onFalse(b)) over imperative repeated calls on a stored variable.
- Use the workflow() builder chain when you must call branch methods more than once — the linter exempts those.
- Run lintWorkflowSdkSource before exporting to surface silent overwrites.
When it happens
Trigger: Calling ifNode.onTrue(a) then ifNode.onTrue(b) on the same stored node variable (b wins, a is lost). Calling switchNode.onCase(0, x) twice. The check is keyed on a direct identifier receiver, so fluent chains on workflow() are intentionally NOT flagged.
Common situations: Imperative style that holds a node reference and calls branch methods in sequence; refactoring that duplicates a wiring call; copy-paste of an onTrue block. The silent overwrite means the bug only shows up as a missing connection at runtime.
Related errors
- SDK_CODE_AFTER_EXPORT_DEFAULT
- SDK_FORBIDDEN_CONSTRUCT
- Eval "${this.evalName}" requires either .check() or .judge()
- Guardrail "${this.name}" requires a type
- Guardrail "${this.name}" requires a strategy
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/a50386fccb1bce9c.
Report an issue: GitHub.