flipped-aurora/gin-vue-admin · error

packageInfo.desc 不能为空

Error message

packageInfo.desc 不能为空

What it means

packageInfo.desc is a required description used in generated package/plugin metadata. validateExecutionPlan rejects an empty Desc so every created package ships with meaningful documentation text.

Source

Thrown at server/mcp/gva_execute.go:315

	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)
			}
			if moduleInfo.TableName == "" {
				return fmt.Errorf("模块 %d 的 tableName 不能为空", moduleIndex+1)
			}

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Set packageInfo.desc to a one-line description of the package/plugin.
  2. Generate a sensible default (e.g. "<label> 插件") when no explicit description exists.
  3. Mark desc as required in whatever UI builds the plan.
  4. Validate required packageInfo fields client-side before invoking.

Example fix

// before
packageInfo: { packageName: "order-center", template: "plugin", label: "订单中心" }

// after
packageInfo: { packageName: "order-center", template: "plugin", label: "订单中心", desc: "订单中心管理插件" }
Defensive patterns

Strategy: validation

Validate before calling

function requireDesc(plan) {
  if (plan.needCreatedPackage && !plan.packageInfo?.desc?.trim()) {
    throw new Error('packageInfo.desc is required');
  }
  return plan;
}

Type guard

function hasPackageDesc(plan) {
  return !plan.needCreatedPackage || (typeof plan.packageInfo?.desc === 'string' && plan.packageInfo.desc.trim().length > 0);
}

Try / catch

try {
  return await callTool('gva_execute', { executionPlan: plan });
} catch (err) {
  if (String(err.message).includes('packageInfo.desc 不能为空')) {
    plan.packageInfo.desc = `${plan.packageInfo.label} 插件`; // generated default description
    return callTool('gva_execute', { executionPlan: plan });
  }
  throw err;
}

Prevention

When it happens

Trigger: executionPlan with needCreatedPackage=true and packageInfo.desc equal to "" or omitted.

Common situations: Same pattern as the label check: plans auto-generated by an LLM skipping the description, or a form where desc was optional client-side; copying packageInfo from an example and deleting desc.

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


AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31). Data as JSON: /api/errors/88a5857120b09da2. Report an issue: GitHub.