{"record":{"id":"cb5fe3ceb64c2333","repo":"can1357/oh-my-pi","slug":"approve-received-invalid-arguments-params-summa","errorCode":null,"errorMessage":"approve received invalid arguments: ${params.summary}","messagePattern":"approve received invalid arguments: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/compress/protocol.ts","lineNumber":207,"sourceCode":"\t\t\t\t\tlosses: draft.losses.length,\n\t\t\t\t};\n\t\t\t\treturn { content: [{ type: \"text\", text: summary }], details };\n\t\t\t},\n\t\t};\n\t}\n\n\t/** Tool that accepts the newest reviewed draft. Thin adapter over {@link accept}. */\n\tapproveTool(): ToolDefinition {\n\t\treturn {\n\t\t\tname: \"approve\",\n\t\t\tlabel: \"Approve\",\n\t\t\tdescription: approveDescription.trim(),\n\t\t\tparameters: approveSchema,\n\t\t\tapproval: \"read\",\n\t\t\tstrict: true,\n\t\t\texecute: async (_toolCallId, rawParams) => {\n\t\t\t\tconst params = approveSchema(rawParams);\n\t\t\t\tif (params instanceof type.errors) throw new Error(`approve received invalid arguments: ${params.summary}`);\n\t\t\t\tconst draft = this.accept(params.verdict);\n\t\t\t\tconst details: ApproveDetails = { round: draft.round };\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `Draft ${draft.round} approved. The run ends here.` }],\n\t\t\t\t\tdetails,\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t}\n}\n","sourceCodeStart":189,"sourceCodeEnd":218,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/compress/protocol.ts#L189-L218","documentation":"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.","triggerScenarios":"Calling the `approve` tool with `verdict` missing or an empty string, or with any extra property alongside `verdict` (schema uses `\"+\": \"reject\"`).","commonSituations":"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.","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"],"exampleFix":"// before\napprove({})\n// after\napprove({ verdict: \"All declared losses are acceptable; draft preserves required behavior.\" })","handlingStrategy":"validation","validationCode":"const parsed = approveSchema(rawParams);\nif (parsed instanceof type.errors) {\n  // repair/retry the tool call using parsed.summary before executing\n}","typeGuard":"function isApproveArgs(p: unknown): p is { verdict: string } {\n  return approveSchema(p) instanceof type.errors === false;\n}","tryCatchPattern":"try {\n  await approveTool.execute(id, rawParams);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"approve received invalid arguments\")) {\n    // ask the model to re-emit approve with a non-empty verdict and no extra keys\n  } else throw err;\n}","preventionTips":["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"],"tags":["validation","schema","tool-arguments"],"backgroundTag":"schema-validation-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}