coleam00/Archon · error
Loop-group node '${node.id}' failed at iteration ${String(i)
Error message
Loop-group node '${node.id}' failed at iteration ${String(i)}: ${failedBodyNodes.join('; ')} What it means
A loop-group node (packages/workflows/src/dag-executor.ts:5061) iterates over groups and runs body nodes per iteration. If any body node fails during iteration i, the executor stops, sends this message to the conversation, logs 'loop_group_node.body_node_failed', and returns the node in state 'failed' with the last iteration's output.
Source
Thrown at packages/workflows/src/dag-executor.ts:5061
loopIterations: i,
};
}
}
// A failed body node fails the group immediately — mirrors the top-level DAG
// (any failed node fails the run) and executeLoopNode (an iteration failure stops
// the loop). Silently re-running the body would burn AI cost every remaining
// iteration and bury the root cause under a generic max-iterations error.
const failedBodyNodes = iterBodyNodes.flatMap(n => {
const o = scopedNodeOutputs.get(n.id);
return o?.state === 'failed' ? [`'${n.id}': ${o.error}`] : [];
});
if (failedBodyNodes.length > 0) {
const errorMsg = `Loop-group node '${node.id}' failed at iteration ${String(i)}: ${failedBodyNodes.join('; ')}`;
getLog().warn(
{ nodeId: node.id, iteration: i, failedCount: failedBodyNodes.length },
'loop_group_node.body_node_failed'
);
await safeSendMessage(platform, conversationId, errorMsg, msgContext);
return {
state: 'failed',
output: lastIterationOutput,
error: errorMsg,
costUsd: loopTotalCostUsd,
...(loopTotalTokens !== undefined ? { tokens: loopTotalTokens } : {}),
loopIterations: i,
};
}
// Carry the body's final sequential session into the next iteration (unless
// fresh_context forces a reset, handled above by seeding undefined).
loopLastSequentialSession = iterCtx.lastSequentialSession;
// Carry prior-iteration snapshot forward for $LOOP_PREV.* on the next iteration.
loopPrevOutputs = new Map(scopedNodeOutputs);
View on GitHub (pinned to 0773b97458)
Solutions
- Inspect the listed failed body node names and its error in run events; fix or add retries to that body node
- Make the body node tolerant (add retries/timeouts, validate group inputs before the loop)
- Gate the loop body on data checks so bad iterations fail fast with a clearer error
- Re-run the workflow after fixing; the loop resumes from the start unless the engine supports resumption
Example fix
// workflow yaml body node
# before
bash: run-tests.sh ${item}
# after
bash: run-tests.sh ${item} || echo "tests failed for ${item}, continuing" # or add retries: on the node Defensive patterns
Strategy: try-catch
Validate before calling
// Validate group data before the loop-group runs:
const groups = JSON.parse(groupsOutput);
if (!Array.isArray(groups) || groups.some(g => g == null)) {
throw new Error('loop-group input must be a non-empty array of valid groups');
} Type guard
function isFailResult(r: { state: string; error?: string }): r is { state: 'failed'; error: string } {
return r.state === 'failed' && typeof r.error === 'string';
} Try / catch
try {
await runLoopGroup(node);
} catch (e) {
// message pattern: "Loop-group node '<id>' failed at iteration <i>: <nodes>"
const m = String(e.message ?? e).match(/Loop-group node '([^']+)' failed at iteration (\d+): (.+)/);
if (m) console.error(`fix body node(s): ${m[3]} (iteration ${m[2]})`);
else throw e;
} Prevention
- Add retries/timeouts to body nodes that call AI or external services
- Validate each group's data before the body runs
- Read failedBodyNodes in the message to target the failing node directly
- Check run events for the body node's own error before re-running
When it happens
Trigger: Inside a loop-group node, one or more body nodes return failed state at iteration i — e.g. a prompt node erroring, a bash node exiting nonzero, or a child failing — with failedBodyNodes listing the failing node names joined by '; '.
Common situations: A flaky AI/prompt node failing on one batch item; a bash step in the loop body hitting a bad input for the i-th group; rate limits mid-loop causing a body node to fail; unvalidated group data causing a script to crash.
Related errors
- Loop-group node '${node.id}' exceeded max iterations (${Stri
- Loop node '${node.id}' exceeded max iterations (${String(loo
- ❌ **Composed fan-out failed** (node `${node.id}`): ${current
- node_loop_interactive_deprecated
- node_loop_until_deprecated
AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01).
Data as JSON: /api/errors/8f5d79375393b28d.
Report an issue: GitHub.