diegosouzapw/OmniRoute · error · Error

Invalid Kiro tool_call payload: input must be an object…

Error message

Invalid Kiro tool_call payload: input must be an object with name and arguments

What it means

Validation in validateKiroToolCallWrapperInput: after parsing, the wrapper's input is not a plain object (null, array, or primitive). The wrapper input must be an object exposing name and arguments for the nested MCP tool, so any other shape is rejected.

Solutions

  1. Reject the malformed wrapper tool_call without killing the surrounding message
  2. Normalize known alternate shapes (e.g. {input: "..."} JSON strings are already handled by parseKiroToolInput) if upstream varies the format
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

  } catch (error) {
    const message = error instanceof Error ? error.message : String(error);
    throw new Error(`Invalid Kiro tool_call payload: input must be valid JSON (${message})`);
  }
}

export function validateKiroToolName(toolUse: JsonRecord): string {
  const toolName = typeof toolUse.name === "string" ? toolUse.name.trim() : "";
  if (!toolName) throw new Error("Invalid Kiro toolUseEvent: missing tool name");
  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);

View on GitHub (pinned to a179ffed5b)