flipped-aurora/gin-vue-admin · error
packageInfo.label 不能为空
Error message
packageInfo.label 不能为空
What it means
packageInfo.label is a required human-readable display name used in generated menus/pages when the package is created. validateExecutionPlan rejects an empty Label because a missing label would leave generated UI with a blank title.
Source
Thrown at server/mcp/gva_execute.go:312
return errors.New("packageType 必须是 'package' 或 'plugin'")
}
if plan.NeedCreatedPackage && plan.PackageInfo != nil && plan.PackageType != plan.PackageInfo.Template {
return errors.New("packageType 和 packageInfo.template 必须保持一致")
}
if plan.NeedCreatedPackage {
if plan.PackageInfo == nil {
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)
}View on GitHub (pinned to 3136500ef3)
Solutions
- Set packageInfo.label to a short display name (e.g. "订单中心").
- Default the label from the package name if no explicit label is available.
- Add label to the plan-building UI/form as a required input.
- Validate required packageInfo fields client-side before calling the tool.
Example fix
// before
packageInfo: { packageName: "order-center", template: "plugin", desc: "订单管理" }
// after
packageInfo: { packageName: "order-center", template: "plugin", label: "订单中心", desc: "订单管理" } Defensive patterns
Strategy: validation
Validate before calling
function requireLabel(plan) {
if (plan.needCreatedPackage && !plan.packageInfo?.label?.trim()) {
throw new Error('packageInfo.label (display name) is required');
}
return plan;
} Type guard
function hasPackageLabel(plan) {
return !plan.needCreatedPackage || (typeof plan.packageInfo?.label === 'string' && plan.packageInfo.label.trim().length > 0);
} Try / catch
try {
return await callTool('gva_execute', { executionPlan: plan });
} catch (err) {
if (String(err.message).includes('packageInfo.label 不能为空')) {
plan.packageInfo.label = plan.packageInfo.packageName; // fallback display name
return callTool('gva_execute', { executionPlan: plan });
}
throw err;
} Prevention
- Make label a required input in any plan-building form
- Default label from the package name when the user does not provide one
- Include label/desc in a single buildPackageInfo() helper so they are never skipped
When it happens
Trigger: executionPlan with needCreatedPackage=true and packageInfo.label equal to "" or omitted.
Common situations: Filling in only technical fields and skipping display metadata; LLM-generated plans omitting Chinese display names; form submissions where the label field was optional in the UI but required here.
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.desc 不能为空
- 当 needCreatedModules=true 时,modulesInfo 不能为空
- 参数错误:executionPlan 必须提供
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/d0774253568105fb.
Report an issue: GitHub.