{"record":{"id":"b35a0486852bbcf2","repo":"diegosouzapw/OmniRoute","slug":"invalid-kiro-tool-call-payload-mixed-input-fragme","errorCode":null,"errorMessage":"Invalid Kiro tool_call payload: mixed input fragment types","messagePattern":"Invalid Kiro tool_call payload: mixed input fragment types","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"open-sse/executors/kiroToolCallValidation.ts","lineNumber":73,"sourceCode":"    );\n  }\n}\n\nexport function validateKiroToolUse(toolUse: JsonRecord): void {\n  const toolName = validateKiroToolName(toolUse);\n  if (toolName === KIRO_TOOL_CALL_WRAPPER) {\n    validateKiroToolCallWrapperInput(toolUse.input);\n  }\n}\n\nexport function appendBufferedKiroToolInput(\n  toolCall: PendingKiroWrapperToolCall,\n  toolInput: unknown\n): void {\n  if (toolInput === undefined) return;\n  if (typeof toolInput === \"string\") {\n    if (toolCall.inputKind && toolCall.inputKind !== \"string\") {\n      throw new Error(\"Invalid Kiro tool_call payload: mixed input fragment types\");\n    }\n    toolCall.inputKind = \"string\";\n    toolCall.inputText = `${toolCall.inputText || \"\"}${toolInput}`;\n    return;\n  }\n  if (toolInput && typeof toolInput === \"object\" && !Array.isArray(toolInput)) {\n    if (toolCall.inputKind && toolCall.inputKind !== \"object\") {\n      throw new Error(\"Invalid Kiro tool_call payload: mixed input fragment types\");\n    }\n    toolCall.inputKind = \"object\";\n    toolCall.inputObject = toolInput as Record<string, unknown>;\n  }\n}\n\nexport function getBufferedKiroToolInput(toolCall: PendingKiroWrapperToolCall): unknown {\n  return toolCall.inputKind === \"string\" ? toolCall.inputText || \"\" : toolCall.inputObject;\n}\n","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/executors/kiroToolCallValidation.ts#L55-L91","documentation":"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.","triggerScenarios":"Thrown at open-sse/executors/kiroToolCallValidation.ts:73 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}