earendil-works/pi · error · Error

Validation failed for tool

Error message

Validation failed for tool "${toolCall.name}":
${errors}

Received arguments:
${JSON.stringify(toolCall.arguments, null, 2)}

What it means

The tool call's arguments failed TypeBox schema validation (after coercion attempts); the message lists each failing path and reason plus the raw received arguments so the schema mismatch is diagnosable. The faulty input is toolCall.arguments against the named tool's schema.

Solutions

  1. Fix the tool call arguments so they satisfy the schema errors listed in the message.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/ai/src/utils/validation.ts:349 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/425f4de4b94bffb4. Report an issue: GitHub.

Appendix: source

Thrown at packages/ai/src/utils/validation.ts:349

			} else {
				return validator.Check(coerced) ? coerced : args;
			}
		}
	}

	if (validator.Check(args)) {
		return args;
	}

	const errors =
		validator
			.Errors(args)
			.map((error) => `  - ${formatValidationPath(error)}: ${error.message}`)
			.join("\n") || "Unknown validation error";

	const errorMessage = `Validation failed for tool "${toolCall.name}":\n${errors}\n\nReceived arguments:\n${JSON.stringify(toolCall.arguments, null, 2)}`;

	throw new Error(errorMessage);
}

View on GitHub (pinned to 4af9d21d3b)