flipped-aurora/gin-vue-admin · error
当 needCreatedModules=true 时,modulesInfo 不能为空
Error message
当 needCreatedModules=true 时,modulesInfo 不能为空
What it means
When NeedCreatedModules is true, validateExecutionPlan requires ModulesInfo to contain at least one module entry. The executor cannot generate "modules" if the list is empty, so the plan is rejected before any module-level validation (each module's package field, etc.) begins.
Source
Thrown at server/mcp/gva_execute.go:321
return errors.New("当 needCreatedPackage=true 时,packageInfo 不能为空")
}
if plan.PackageInfo.PackageName == "" {
return errors.New("packageInfo.packageName 不能为空")
}
if plan.PackageInfo.Template != "package" && plan.PackageInfo.Template != "plugin" {
return errors.New("packageInfo.template 必须是 'package' 或 'plugin'")
}
if plan.PackageInfo.Label == "" {
return errors.New("packageInfo.label 不能为空")
}
if plan.PackageInfo.Desc == "" {
return errors.New("packageInfo.desc 不能为空")
}
}
if plan.NeedCreatedModules {
if len(plan.ModulesInfo) == 0 {
return errors.New("当 needCreatedModules=true 时,modulesInfo 不能为空")
}
for moduleIndex, moduleInfo := range plan.ModulesInfo {
if moduleInfo.Package == "" {
return fmt.Errorf("模块 %d 的 package 不能为空", moduleIndex+1)
}
if moduleInfo.StructName == "" {
return fmt.Errorf("模块 %d 的 structName 不能为空", moduleIndex+1)
}
if moduleInfo.TableName == "" {
return fmt.Errorf("模块 %d 的 tableName 不能为空", moduleIndex+1)
}
if moduleInfo.Description == "" {
return fmt.Errorf("模块 %d 的 description 不能为空", moduleIndex+1)
}
if moduleInfo.Abbreviation == "" {
return fmt.Errorf("模块 %d 的 abbreviation 不能为空", moduleIndex+1)
}View on GitHub (pinned to 3136500ef3)
Solutions
- Provide at least one entry in modulesInfo, each with a non-empty `package` field.
- If no modules should be generated, set needCreatedModules: false instead of leaving an empty list.
- Ensure the client actually serializes a non-empty modulesInfo array (empty arrays may be dropped by some serializers).
- Validate the flag/list pairing client-side before calling the tool.
Example fix
// before
{ packageName: "order-center", packageType: "plugin", needCreatedModules: true }
// after
{ packageName: "order-center", packageType: "plugin", needCreatedModules: true,
modulesInfo: [
{ package: "order", moduleName: "order", label: "订单", desc: "订单管理" }
] } Defensive patterns
Strategy: validation
Validate before calling
function requireModulesWhenFlagged(plan) {
if (plan.needCreatedModules && (!Array.isArray(plan.modulesInfo) || plan.modulesInfo.length === 0)) {
throw new Error('needCreatedModules=true requires a non-empty modulesInfo array');
}
return plan;
} Type guard
function hasModulesWhenFlagged(plan) {
return !plan.needCreatedModules || (Array.isArray(plan.modulesInfo) && plan.modulesInfo.length > 0 && plan.modulesInfo.every(m => typeof m?.package === 'string' && m.package.length > 0));
} Try / catch
try {
return await callTool('gva_execute', { executionPlan: plan });
} catch (err) {
if (String(err.message).includes('modulesInfo 不能为空')) {
plan.needCreatedModules = false; // or plan.modulesInfo = buildDefaultModules(plan)
return callTool('gva_execute', { executionPlan: plan });
}
throw err;
} Prevention
- Only set needCreatedModules=true when at least one module entry is ready
- Verify your JSON serializer emits empty arrays (some omit them)
- Build modulesInfo and the flag together via one factory so they stay in sync
When it happens
Trigger: executionPlan has `needCreatedModules: true` but `modulesInfo` is an empty array or omitted from the plan JSON.
Common situations: A plan template with the flag defaulted to true and no modules filled in; an LLM emitting the flag intending module creation later; serialization dropping an empty array; confusion between needCreatedPackage and needCreatedModules flags.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- packageName 不能为空
- packageInfo.packageName 不能为空
- packageInfo.label 不能为空
- packageInfo.desc 不能为空
- 参数错误:executionPlan 必须提供
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/da4ebddbd043e247.
Report an issue: GitHub.