diegosouzapw/OmniRoute · error · Error

Invalid Kiro tool_call payload: missing nested MCP tool…

Error message

Invalid Kiro tool_call payload: missing nested MCP tool arguments at input.arguments

What it means

Validation guard inside validateKiroToolCallWrapperInput: a Kiro tool_call wrapped in the MCP wrapper tool arrived with input.arguments missing or not the expected nested object, so the inner tool's arguments cannot be decoded. It fires when the upstream Kiro stream emits a wrapper payload whose input object lacks a well-formed arguments field.

Solutions

  1. Fix the producer so wrapper tool_calls always embed input.arguments as an object containing name and arguments
  2. Log the raw toolInput to identify the malformed upstream frame
  3. Reject the frame early instead of propagating a half-parsed tool call downstream
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at open-sse/executors/kiroToolCallValidation.ts:53 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/e321acd70ebd676b. Report an issue: GitHub.

Appendix: source

Thrown at open-sse/executors/kiroToolCallValidation.ts:53

  return toolName;
}

export function validateKiroToolCallWrapperInput(toolInput: unknown): void {
  if (toolInput === undefined) {
    throw new Error("Invalid Kiro tool_call payload: missing input");
  }
  const input = parseKiroToolInput(toolInput);
  if (!input || typeof input !== "object" || Array.isArray(input)) {
    throw new Error(
      "Invalid Kiro tool_call payload: input must be an object with name and arguments"
    );
  }
  const record = input as JsonRecord;
  if (typeof record.name !== "string" || !record.name.trim()) {
    throw new Error("Invalid Kiro tool_call payload: missing nested MCP tool name at input.name");
  }
  if (!Object.prototype.hasOwnProperty.call(record, "arguments")) {
    throw new Error(
      "Invalid Kiro tool_call payload: missing nested MCP tool arguments at input.arguments"
    );
  }
}

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") {

View on GitHub (pinned to a179ffed5b)