flipped-aurora/gin-vue-admin · error
解析执行计划失败: %v
Error message
解析执行计划失败: %v
What it means
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.
Source
Thrown at server/mcp/gva_execute.go:224
mcp.AdditionalProperties(false),
),
mcp.WithString("requirement",
mcp.Description("原始需求描述(可选,用于日志记录)"),
),
)
}
// Handle 处理执行请求(移除确认步骤)
func (g *GVAExecutor) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
executionPlanData, ok := request.GetArguments()["executionPlan"]
if !ok {
return nil, errors.New("参数错误:executionPlan 必须提供")
}
// 解析执行计划
planJSON, err := json.Marshal(executionPlanData)
if err != nil {
return nil, fmt.Errorf("解析执行计划失败: %v", err)
}
var plan ExecutionPlan
err = json.Unmarshal(planJSON, &plan)
if err != nil {
return nil, fmt.Errorf("解析执行计划失败: %v\n\n请确保ExecutionPlan格式正确,参考工具描述中的结构体格式要求", err)
}
// 验证执行计划的完整性
if err := g.validateExecutionPlan(ctx, &plan); err != nil {
return nil, fmt.Errorf("执行计划验证失败: %v", err)
}
// 获取原始需求(可选)
var originalRequirement string
if reqData, ok := request.GetArguments()["requirement"]; ok {
if reqStr, ok := reqData.(string); ok {
originalRequirement = reqStrView on GitHub (pinned to 3136500ef3)
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).
Example fix
// before
{"executionPlan": "{\"packageName\":\"user\"}"}
// after: pass a real object, not a JSON string
{"executionPlan": {"packageName": "user", "packageType": "package", "needCreatedPackage": false, "needCreatedModules": false, "needCreatedDictionaries": false}} Defensive patterns
Strategy: validation
Validate before calling
function validateExecutionPlanArg(args) {
const p = args?.executionPlan
return typeof p === 'object' && p !== null && !Array.isArray(p) && typeof p.packageName === 'string' && p.packageName.length > 0
} Type guard
function isExecutionPlanObject(v) {
return typeof v === 'object' && v !== null && !Array.isArray(v) && typeof v.packageName === 'string'
} Try / catch
if (!isExecutionPlanObject(args.executionPlan)) {
throw new Error('executionPlan must be a plain object per the tool schema')
}
const result = await callTool('gva_execute', args) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- 参数错误:generatedFiles 必须是JSON字符串
- 解析执行计划失败: %v 请确保ExecutionPlan格式正确,参考工具描述中的结构体格式要求
- 未找到 MCP 独立配置文件,请在当前目录、cmd/mcp 目录或通过 -config / GVA_MCP_CONFIG
- 未能自动识别项目根目录,请在 MCP 配置中设置 autocode.root
- go.mod 中未找到 module 定义
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/cf590691b34ef218.
Report an issue: GitHub.