flipped-aurora/gin-vue-admin · error
执行计划验证失败: %v
Error message
执行计划验证失败: %v
What it means
gva_execute's Handle (server/mcp/gva_execute.go:235) wraps errors from validateExecutionPlan with "执行计划验证失败: %v". The plan parsed fine as JSON, but its semantic content violates business rules — empty required fields, mismatched packageType/template, invalid fieldType, wrong primaryKey configuration, etc. The real reason is always in the suffix.
Source
Thrown at server/mcp/gva_execute.go:235
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 = reqStr
}
}
// 直接执行创建操作(无确认步骤)
result := g.executeCreation(ctx, &plan)
// 如果执行成功且有原始需求,提供代码复检建议
var reviewMessage string
if result.Success && originalRequirement != "" {
logger.WithCtx(ctx).Mod("mcp").Info("执行完成,返回生成的文件路径供AI进行代码复检...")
View on GitHub (pinned to 3136500ef3)
Solutions
- Read the suffix message — it names the exact module/field and the violated rule.
- Fill every required module field: package, structName, tableName, description, abbreviation, packageName, humpPackageName, and at least one field.
- Ensure packageType is 'package' or 'plugin' and matches packageInfo.template when needCreatedPackage=true.
- Use only supported fieldTypes (string, int, int64, float64, bool, time.Time, enum, picture, video, file, pictures, array, richtext, json).
- Set gvaModel=true without any primaryKey field, or gvaModel=false with exactly one primaryKey=true field.
- Run gva_analyze first to confirm the target package exists.
Example fix
// before: module missing abbreviation/humpPackageName
"modulesInfo":[{"package":"user","structName":"User","tableName":"users","description":"用户","fields":[...]}]
// after: supply all required metadata
"modulesInfo":[{"package":"user","structName":"User","tableName":"users","description":"用户管理","abbreviation":"u","packageName":"user","humpPackageName":"user","gvaModel":true,"fields":[{"fieldName":"UserName","fieldDesc":"用户名","fieldType":"string","fieldJson":"userName","columnName":"user_name"}]}] Defensive patterns
Strategy: validation
Validate before calling
const REQUIRED_MODULE = ['package','structName','tableName','description','abbreviation','packageName','humpPackageName']
function validatePlan(plan) {
if (!plan.packageName) return 'packageName required'
if (!['package','plugin'].includes(plan.packageType)) return 'packageType must be package|plugin'
if (plan.needCreatedPackage && !plan.packageInfo) return 'packageInfo required when needCreatedPackage'
if (plan.needCreatedModules) {
if (!Array.isArray(plan.modulesInfo) || plan.modulesInfo.length === 0) return 'modulesInfo required when needCreatedModules'
for (const [i, m] of plan.modulesInfo.entries()) {
for (const f of REQUIRED_MODULE) if (!m[f]) return `module ${i + 1}: ${f} required`
if (!Array.isArray(m.fields) || m.fields.length === 0) return `module ${i + 1}: fields required`
}
}
return null
} Try / catch
const problem = validatePlan(plan)
if (problem) throw new Error('pre-validate: ' + problem)
try {
return await callTool('gva_execute', { executionPlan: plan })
} catch (e) {
if (String(e.message).includes('执行计划验证失败')) console.error(e.message) // suffix names the rule
throw e
} Prevention
- Keep a validated plan template covering all required fields.
- Always run gva_analyze before executing to confirm the target package.
- Use only fieldTypes from the supported list in the tool description.
- Enforce gvaModel/primaryKey exclusivity in your plan builder.
When it happens
Trigger: Any gva_execute call whose ExecutionPlan fails a validation rule: packageName empty, packageType not 'package'/'plugin', needCreatedPackage=true without packageInfo, needCreatedModules=true with missing/invalid module fields, gvaModel/primaryKey conflicts, unsupported field types.
Common situations: LLM-generated plans omitting required module metadata (abbreviation, humpPackageName); plans where packageType and packageInfo.template disagree; field configs using types like 'uint' or 'datetime' not in the allowed list.
Related errors
- 模块 %d 的 package 不能为空
- 模块 %d 的 structName 不能为空
- 参数错误:executionPlan 必须提供
- packageName 不能为空
- packageType 必须是 'package' 或 'plugin'
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/7c22a9d476f38421.
Report an issue: GitHub.