{"record":{"id":"dc4012ab583f772d","repo":"flipped-aurora/gin-vue-admin","slug":"d-tablename","errorCode":null,"errorMessage":"模块 %d 的 tableName 不能为空","messagePattern":"模块 (.+?) 的 tableName 不能为空","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/gva_execute.go","lineNumber":332,"sourceCode":"\t\tif plan.PackageInfo.Desc == \"\" {\n\t\t\treturn errors.New(\"packageInfo.desc 不能为空\")\n\t\t}\n\t}\n\n\tif plan.NeedCreatedModules {\n\t\tif len(plan.ModulesInfo) == 0 {\n\t\t\treturn errors.New(\"当 needCreatedModules=true 时，modulesInfo 不能为空\")\n\t\t}\n\n\t\tfor moduleIndex, moduleInfo := range plan.ModulesInfo {\n\t\t\tif moduleInfo.Package == \"\" {\n\t\t\t\treturn fmt.Errorf(\"模块 %d 的 package 不能为空\", moduleIndex+1)\n\t\t\t}\n\t\t\tif moduleInfo.StructName == \"\" {\n\t\t\t\treturn fmt.Errorf(\"模块 %d 的 structName 不能为空\", moduleIndex+1)\n\t\t\t}\n\t\t\tif moduleInfo.TableName == \"\" {\n\t\t\t\treturn fmt.Errorf(\"模块 %d 的 tableName 不能为空\", moduleIndex+1)\n\t\t\t}\n\t\t\tif moduleInfo.Description == \"\" {\n\t\t\t\treturn fmt.Errorf(\"模块 %d 的 description 不能为空\", moduleIndex+1)\n\t\t\t}\n\t\t\tif moduleInfo.Abbreviation == \"\" {\n\t\t\t\treturn fmt.Errorf(\"模块 %d 的 abbreviation 不能为空\", moduleIndex+1)\n\t\t\t}\n\t\t\tif moduleInfo.PackageName == \"\" {\n\t\t\t\treturn fmt.Errorf(\"模块 %d 的 packageName 不能为空\", moduleIndex+1)\n\t\t\t}\n\t\t\tif moduleInfo.HumpPackageName == \"\" {\n\t\t\t\treturn fmt.Errorf(\"模块 %d 的 humpPackageName 不能为空\", moduleIndex+1)\n\t\t\t}\n\t\t\tif len(moduleInfo.Fields) == 0 {\n\t\t\t\treturn fmt.Errorf(\"模块 %d 的 fields 不能为空，至少需要一个字段\", moduleIndex+1)\n\t\t\t}\n\n\t\t\tfor i, field := range moduleInfo.Fields {","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/gva_execute.go#L314-L350","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add a non-empty tableName to the module entry in the execution plan","If unsure of the table name, check the existing GORM model or migration for the target table and use its exact name","Re-run the gva_execute tool after fixing the plan"],"exampleFix":"// before\n{\"modules\":[{\"packageName\":\"article\",\"structName\":\"Article\"}]}\n// after\n{\"modules\":[{\"packageName\":\"article\",\"structName\":\"Article\",\"tableName\":\"article\"}]}","handlingStrategy":"validation","validationCode":"for i, m := range plan.Modules {\n  if m.TableName == \"\" {\n    return fmt.Errorf(\"modules[%d].tableName is required\", i)\n  }\n}","typeGuard":"func hasTableName(m Module) bool { return m.TableName != \"\" }","tryCatchPattern":null,"preventionTips":["Build plan JSON from a template that includes tableName by default","Validate the whole plan against a JSON schema before calling gva_execute","Derive tableName from structName automatically (snake_case) when authoring plans"],"tags":["mcp","code-generation","validation","config"],"backgroundTag":"missing-required-field","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}