{"record":{"id":"cf590691b34ef218","repo":"flipped-aurora/gin-vue-admin","slug":"v-cf5906","errorCode":null,"errorMessage":"解析执行计划失败: %v","messagePattern":"解析执行计划失败: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/gva_execute.go","lineNumber":224,"sourceCode":"\t\t\tmcp.AdditionalProperties(false),\n\t\t),\n\t\tmcp.WithString(\"requirement\",\n\t\t\tmcp.Description(\"原始需求描述（可选，用于日志记录）\"),\n\t\t),\n\t)\n}\n\n// Handle 处理执行请求（移除确认步骤）\nfunc (g *GVAExecutor) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {\n\texecutionPlanData, ok := request.GetArguments()[\"executionPlan\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"参数错误：executionPlan 必须提供\")\n\t}\n\n\t// 解析执行计划\n\tplanJSON, err := json.Marshal(executionPlanData)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"解析执行计划失败: %v\", err)\n\t}\n\n\tvar plan ExecutionPlan\n\terr = json.Unmarshal(planJSON, &plan)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"解析执行计划失败: %v\\n\\n请确保ExecutionPlan格式正确，参考工具描述中的结构体格式要求\", err)\n\t}\n\n\t// 验证执行计划的完整性\n\tif err := g.validateExecutionPlan(ctx, &plan); err != nil {\n\t\treturn nil, fmt.Errorf(\"执行计划验证失败: %v\", err)\n\t}\n\n\t// 获取原始需求（可选）\n\tvar originalRequirement string\n\tif reqData, ok := request.GetArguments()[\"requirement\"]; ok {\n\t\tif reqStr, ok := reqData.(string); ok {\n\t\t\toriginalRequirement = reqStr","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/gva_execute.go#L206-L242","documentation":"The gva_execute tool's Handle (server/mcp/gva_execute.go:224) re-serializes the raw executionPlan argument to JSON before unmarshaling into ExecutionPlan. If this intermediate json.Marshal of the client-supplied value fails, the plan can't be parsed and this error is returned. Distinct from the more common Unmarshal failure at line 230 — this one indicates the argument itself is not a marshalable structure.","triggerScenarios":"Calling gva_execute with an executionPlan argument that json.Marshal cannot process — e.g. the MCP client passed a non-object value (number, func-like placeholder) or a structure the marshaler rejects instead of a JSON object.","commonSituations":"MCP clients sending malformed tool arguments (executionPlan as a string or null variant instead of an object); buggy client-side argument construction; proxy layers mangling the arguments map.","solutions":["Confirm the client sends executionPlan as a JSON object, not a stringified JSON or scalar.","Print/log the raw executionPlan argument to see what was actually received.","If JSON-stringified, parse it client-side into an object before invoking the tool.","Align the call with the schema in the tool description (packageName, packageType, flags, packageInfo/modulesInfo)."],"exampleFix":"// before\n{\"executionPlan\": \"{\\\"packageName\\\":\\\"user\\\"}\"}\n// after: pass a real object, not a JSON string\n{\"executionPlan\": {\"packageName\": \"user\", \"packageType\": \"package\", \"needCreatedPackage\": false, \"needCreatedModules\": false, \"needCreatedDictionaries\": false}}","handlingStrategy":"validation","validationCode":"function validateExecutionPlanArg(args) {\n  const p = args?.executionPlan\n  return typeof p === 'object' && p !== null && !Array.isArray(p) && typeof p.packageName === 'string' && p.packageName.length > 0\n}","typeGuard":"function isExecutionPlanObject(v) {\n  return typeof v === 'object' && v !== null && !Array.isArray(v) && typeof v.packageName === 'string'\n}","tryCatchPattern":"if (!isExecutionPlanObject(args.executionPlan)) {\n  throw new Error('executionPlan must be a plain object per the tool schema')\n}\nconst result = await callTool('gva_execute', args)","preventionTips":["Never JSON.stringify executionPlan into a string argument.","Build the payload programmatically from the tool schema rather than hand-writing JSON.","Log the exact arguments sent to the tool for debugging."],"tags":["mcp","json","argument-parsing","go"],"backgroundTag":"invalid-tool-arguments","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}