can1357/oh-my-pi · error
approve received invalid arguments: ${params.summary}
Error message
approve received invalid arguments: ${params.summary} What it means
The `approve` tool validates its raw arguments against `approveSchema` (`{ verdict: string>0 }`, unknown keys rejected). When validation fails, the executor throws with the ArkType error summary. The agent must supply a non-empty verdict string and nothing else.
Source
Thrown at packages/coding-agent/src/compress/protocol.ts:207
losses: draft.losses.length,
};
return { content: [{ type: "text", text: summary }], details };
},
};
}
/** Tool that accepts the newest reviewed draft. Thin adapter over {@link accept}. */
approveTool(): ToolDefinition {
return {
name: "approve",
label: "Approve",
description: approveDescription.trim(),
parameters: approveSchema,
approval: "read",
strict: true,
execute: async (_toolCallId, rawParams) => {
const params = approveSchema(rawParams);
if (params instanceof type.errors) throw new Error(`approve received invalid arguments: ${params.summary}`);
const draft = this.accept(params.verdict);
const details: ApproveDetails = { round: draft.round };
return {
content: [{ type: "text", text: `Draft ${draft.round} approved. The run ends here.` }],
details,
};
},
};
}
}
View on GitHub (pinned to 9690622007)
Solutions
- Re-invoke `approve` with exactly `{ verdict: "<non-empty reason for accepting>" }` and no other keys
- Read the thrown `params.summary` for the exact violated constraint
- Check the tool call JSON for truncation or extra fields if the arguments look well-formed at a glance
Example fix
// before
approve({})
// after
approve({ verdict: "All declared losses are acceptable; draft preserves required behavior." }) Defensive patterns
Strategy: validation
Validate before calling
const parsed = approveSchema(rawParams);
if (parsed instanceof type.errors) {
// repair/retry the tool call using parsed.summary before executing
} Type guard
function isApproveArgs(p: unknown): p is { verdict: string } {
return approveSchema(p) instanceof type.errors === false;
} Try / catch
try {
await approveTool.execute(id, rawParams);
} catch (err) {
if (err instanceof Error && err.message.startsWith("approve received invalid arguments")) {
// ask the model to re-emit approve with a non-empty verdict and no extra keys
} else throw err;
} Prevention
- Always emit a non-empty `verdict` string when calling approve
- Do not add extra fields like `draftId` — the schema rejects unknown keys
- Remind the model of the approve argument shape in the tool description when validation errors recur
When it happens
Trigger: Calling the `approve` tool with `verdict` missing or an empty string, or with any extra property alongside `verdict` (schema uses `"+": "reject"`).
Common situations: A model emits `approve({})` or `approve({ verdict: "" })` when it has nothing to say; extra fields like `draftId` are attached; malformed streaming JSON yields a partial object.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- rewrite received invalid arguments: ${params.summary}
- anthropic-messages: ${data.summary}
- Schema contains a circular object graph — cannot enforce str
- Schema node has no type, combinator, or $ref — cannot enforc
- Validation failed for tool "${toolCall.name}":\n${errors}\n\
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/cb5fe3ceb64c2333.
Report an issue: GitHub.