flipped-aurora/gin-vue-admin · error

模块 %d 的 tableName 不能为空

Error message

模块 %d 的 tableName 不能为空

What it means

The MCP code-generation tool (gva_execute) validates each module entry of the submitted execution plan before running generation. This error is thrown by validateExecutionPlan when a module's TableName field is an empty string. TableName is required because the generator uses it to build the GORM model's table mapping and database migration target.

Source

Thrown at server/mcp/gva_execute.go:332

		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)
			}
			if moduleInfo.PackageName == "" {
				return fmt.Errorf("模块 %d 的 packageName 不能为空", moduleIndex+1)
			}
			if moduleInfo.HumpPackageName == "" {
				return fmt.Errorf("模块 %d 的 humpPackageName 不能为空", moduleIndex+1)
			}
			if len(moduleInfo.Fields) == 0 {
				return fmt.Errorf("模块 %d 的 fields 不能为空,至少需要一个字段", moduleIndex+1)
			}

			for i, field := range moduleInfo.Fields {

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Add a non-empty tableName to the module entry in the execution plan
  2. If unsure of the table name, check the existing GORM model or migration for the target table and use its exact name
  3. Re-run the gva_execute tool after fixing the plan

Example fix

// before
{"modules":[{"packageName":"article","structName":"Article"}]}
// after
{"modules":[{"packageName":"article","structName":"Article","tableName":"article"}]}
Defensive patterns

Strategy: validation

Validate before calling

for i, m := range plan.Modules {
  if m.TableName == "" {
    return fmt.Errorf("modules[%d].tableName is required", i)
  }
}

Type guard

func hasTableName(m Module) bool { return m.TableName != "" }

Prevention

When it happens

Trigger: Calling the MCP gva_execute tool with an execution plan whose modules[i].tableName is omitted, null, or set to "". The validation runs inside Handle before any code is generated.

Common situations: LLM-generated plans that skip optional-looking keys; hand-written plan JSON where the author assumed tableName could be inferred from structName; renamed tables without updating the plan.

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/dc4012ab583f772d. Report an issue: GitHub.