{"record":{"id":"8933d63c0ea3781b","repo":"can1357/oh-my-pi","slug":"agent-received-invalid-arguments-result-summa","errorCode":null,"errorMessage":"agent() received invalid arguments: ${result.summary}","messagePattern":"agent\\(\\) received invalid arguments: (.+?)","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/eval/agent-bridge.ts","lineNumber":78,"sourceCode":"\t\tid: string;\n\t\tmodel?: string | string[];\n\t\tstructured: boolean;\n\t\tschemaSource?: \"caller\" | \"agent\" | \"session\";\n\t\tschemaMode?: StructuredSubagentSchemaMode;\n\t\tschemaStatus?: \"valid\" | \"invalid\";\n\t\tisolated?: boolean;\n\t\tpatchPath?: string;\n\t\tbranchName?: string;\n\t\tnestedPatches?: NestedRepoPatch[];\n\t\tchangesApplied?: boolean | null;\n\t\tisolationSummary?: string;\n\t};\n}\n\nfunction parseAgentArgs(args: unknown): EvalAgentArgs {\n\tconst result = agentArgsSchema(args);\n\tif (result instanceof type.errors) {\n\t\tthrow new ToolError(`agent() received invalid arguments: ${result.summary}`);\n\t}\n\treturn result;\n}\n\nfunction trimToUndefined(value: string | undefined): string | undefined {\n\tconst trimmed = value?.trim();\n\treturn trimmed ? trimmed : undefined;\n}\n\nfunction emitProgressStatus(emitStatus: ((event: JsStatusEvent) => void) | undefined, progress: AgentProgress): void {\n\tif (!emitStatus) return;\n\tconst preview = (progress.assignment ?? progress.task ?? \"\").split(\"\\n\")[0]?.slice(0, 120);\n\temitStatus({\n\t\top: \"agent\",\n\t\tid: progress.id,\n\t\tagent: progress.agent,\n\t\tstatus: progress.status,\n\t\tlastIntent: progress.lastIntent,","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/eval/agent-bridge.ts#L60-L96","documentation":"The eval agent() bridge validates its arguments with an ArkType schema (agentArgsSchema). When the supplied args fail validation, the schema's error summary is wrapped in a ToolError naming the agent() call so eval authors know which tool rejected their input.","triggerScenarios":"Calling agent() in an eval cell with missing required fields, wrong types (e.g. prompt as number), unknown properties, or malformed isolation flags (isolated/apply/merge) that the schema rejects.","commonSituations":"Typo'd argument names in eval frontmatter/cells; passing an object where a string is expected; schema evolution after a version upgrade added a required field; JSON-derived args with null where undefined was expected.","solutions":["Read result.summary in the message to see each failing field and expected type","Fix the argument names/types to match agentArgsSchema","Check the current package version's schema for renamed/added required args","Validate args with the schema before the call in a test harness"],"exampleFix":"// before\nagent({ promt: 'do the thing', isolated: 'yes' })\n// after\nagent({ prompt: 'do the thing', isolated: true })","handlingStrategy":"validation","validationCode":"const res = agentArgsSchema(args);\nif (res instanceof type.errors) console.error(res.summary); else proceed(res);","typeGuard":"function isValidAgentArgs(a: unknown): a is EvalAgentArgs { return !(agentArgsSchema(a) instanceof type.errors); }","tryCatchPattern":"try { await runEvalAgent(args, opts) } catch (e) { if (/agent\\(\\) received invalid arguments/.test(e.message)) { fixArgsFromSummary(e.message); } else throw e }","preventionTips":["Check arg names against the schema (prompt vs promt typos)","Use booleans not strings for flags like isolated","Pin package version and re-check schema after upgrades","Write a schema round-trip test for eval cells"],"tags":["validation","arktype","eval","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}