diegosouzapw/OmniRoute · error
[Kiro] Max iterations reached in event parsing
Error message
[Kiro] Max iterations reached in event parsing
What it means
The Kiro event-stream parsing loop exceeded its maximum iteration bound while consuming parsed events — a guard against runaway/malformed event sequences that would otherwise loop indefinitely. Parsing is capped and the excess events are dropped, so the response may be truncated relative to what the upstream sent.
Solutions
- Treat as upstream protocol anomaly — retry the request
- Check for Kiro event-stream format changes if it recurs
- Report recurring truncation with the captured event sequence
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at open-sse/executors/kiro.ts:952 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/531ef2379c924e85.
Report an issue: GitHub.
Appendix: source
Thrown at open-sse/executors/kiro.ts:952
// input/output totals. Preserve them instead of dropping the
// whole frame, and let ensureKiroUsage() fill the totals from
// contextUsagePercentage.
state.usage = {
...(state.usage || {}),
...((cacheReadTokens || 0) > 0 && {
cache_read_input_tokens: cacheReadTokens,
}),
...((cacheCreationTokens || 0) > 0 && {
cache_creation_input_tokens: cacheCreationTokens,
}),
};
}
}
}
}
if (iterations >= maxIterations) {
console.warn("[Kiro] Max iterations reached in event parsing");
}
},
flush(controller) {
if (!flushPendingWrapperToolCalls(controller)) return;
if (state.invalidToolCall) return;
// Flush any buffered tool arguments (partial-object payloads) before finishing —
// idempotent against toolArgsEmitted if messageStopEvent already flushed them.
flushBufferedToolArgs(state, controller, { responseId, created, model });
// Drain any pending inline-thinking tag fragment so we don't drop
// trailing characters when the stream ends mid-tag (e.g. `<thi`).
if (thinkingExpected && state.thinking) {
const thinkingState = state.thinking;
flushPendingThinking(
thinkingState,
(text) => {
if (!text) return;View on GitHub (pinned to a179ffed5b)