diegosouzapw/OmniRoute · error · Error
Invalid Kiro tool_call payload: mixed input fragment types
Error message
Invalid Kiro tool_call payload: mixed input fragment types
What it means
Guard in appendBufferedKiroToolInput: streamed fragments of a Kiro wrapper tool_call's input arrived as strings after earlier fragments of another kind (or vice versa). The buffered accumulator only supports one homogeneous fragment type, so mixing them would corrupt reassembly of the JSON arguments.
Solutions
- Ensure the streaming producer emits a consistent fragment kind for a single tool_call
- Track inputKind on the pending call and reset buffering when the kind changes legitimately
- Surface the mixed-type frame to the client as an invalid tool_call instead of concatenating incompatible types
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at open-sse/executors/kiroToolCallValidation.ts:73 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/b35a0486852bbcf2.
Report an issue: GitHub.
Appendix: source
Thrown at open-sse/executors/kiroToolCallValidation.ts:73
);
}
}
export function validateKiroToolUse(toolUse: JsonRecord): void {
const toolName = validateKiroToolName(toolUse);
if (toolName === KIRO_TOOL_CALL_WRAPPER) {
validateKiroToolCallWrapperInput(toolUse.input);
}
}
export function appendBufferedKiroToolInput(
toolCall: PendingKiroWrapperToolCall,
toolInput: unknown
): void {
if (toolInput === undefined) return;
if (typeof toolInput === "string") {
if (toolCall.inputKind && toolCall.inputKind !== "string") {
throw new Error("Invalid Kiro tool_call payload: mixed input fragment types");
}
toolCall.inputKind = "string";
toolCall.inputText = `${toolCall.inputText || ""}${toolInput}`;
return;
}
if (toolInput && typeof toolInput === "object" && !Array.isArray(toolInput)) {
if (toolCall.inputKind && toolCall.inputKind !== "object") {
throw new Error("Invalid Kiro tool_call payload: mixed input fragment types");
}
toolCall.inputKind = "object";
toolCall.inputObject = toolInput as Record<string, unknown>;
}
}
export function getBufferedKiroToolInput(toolCall: PendingKiroWrapperToolCall): unknown {
return toolCall.inputKind === "string" ? toolCall.inputText || "" : toolCall.inputObject;
}
View on GitHub (pinned to a179ffed5b)