flipped-aurora/gin-vue-admin · error
模块 %d 字段 %d 的 fieldType 不能为空
Error message
模块 %d 字段 %d 的 fieldType 不能为空
What it means
Each field must declare a FieldType drawn from the generator's supported Go types (string, int, int64, float64, bool, time.Time, enum, picture, video, file, pictures, array, richtext, json). validateExecutionPlan throws this error when fields[i].fieldType is empty; an unsupported non-empty value triggers a different error.
Source
Thrown at server/mcp/gva_execute.go:364
if len(moduleInfo.Fields) == 0 {
return fmt.Errorf("模块 %d 的 fields 不能为空,至少需要一个字段", moduleIndex+1)
}
for i, field := range moduleInfo.Fields {
if field.FieldName == "" {
return fmt.Errorf("模块 %d 字段 %d 的 fieldName 不能为空", moduleIndex+1, i+1)
}
if len(field.FieldName) > 0 {
firstChar := string(field.FieldName[0])
if firstChar >= "a" && firstChar <= "z" {
moduleInfo.Fields[i].FieldName = strings.ToUpper(firstChar) + field.FieldName[1:]
}
}
if field.FieldDesc == "" {
return fmt.Errorf("模块 %d 字段 %d 的 fieldDesc 不能为空", moduleIndex+1, i+1)
}
if field.FieldType == "" {
return fmt.Errorf("模块 %d 字段 %d 的 fieldType 不能为空", moduleIndex+1, i+1)
}
if field.FieldJson == "" {
return fmt.Errorf("模块 %d 字段 %d 的 fieldJson 不能为空", moduleIndex+1, i+1)
}
if field.ColumnName == "" {
return fmt.Errorf("模块 %d 字段 %d 的 columnName 不能为空", moduleIndex+1, i+1)
}
validFieldTypes := []string{"string", "int", "int64", "float64", "bool", "time.Time", "enum", "picture", "video", "file", "pictures", "array", "richtext", "json"}
if !slices.Contains(validFieldTypes, field.FieldType) {
return fmt.Errorf("模块 %d 字段 %d 的 fieldType '%s' 不支持", moduleIndex+1, i+1, field.FieldType)
}
if field.FieldSearchType != "" {
validSearchTypes := []string{"=", "!=", ">", ">=", "<", "<=", "LIKE", "BETWEEN", "NOT BETWEEN", "IN", "NOT IN"}
if !slices.Contains(validSearchTypes, field.FieldSearchType) {
return fmt.Errorf("模块 %d 字段 %d 的 fieldSearchType '%s' 不支持", moduleIndex+1, i+1, field.FieldSearchType)
}View on GitHub (pinned to 3136500ef3)
Solutions
- Set fieldType to one of the supported values: string, int, int64, float64, bool, time.Time, enum, picture, video, file, pictures, array, richtext, json
- Map SQL types: varchar->string, bigint->int64, timestamp->time.Time, etc.
- Re-run gva_execute
Example fix
// before
{"fieldName":"Name","fieldDesc":"name","fieldType":""}
// after
{"fieldName":"Name","fieldDesc":"name","fieldType":"string"} Defensive patterns
Strategy: validation
Validate before calling
var validTypes = map[string]bool{"string":true,"int":true,"int64":true,"float64":true,"bool":true,"time.Time":true,"enum":true,"picture":true,"video":true,"file":true,"pictures":true,"array":true,"richtext":true,"json":true}
for i, m := range plan.Modules {
for j, f := range m.Fields {
if !validTypes[f.FieldType] {
return fmt.Errorf("modules[%d].fields[%d].fieldType invalid: %q", i, j, f.FieldType)
}
}
} Type guard
func hasValidFieldType(f Field) bool {
switch f.FieldType {
case "string","int","int64","float64","bool","time.Time","enum","picture","video","file","pictures","array","richtext","json":
return true
}
return false
} Prevention
- Map SQL column types to supported Go-side types before writing the plan
- Never leave fieldType empty or use raw SQL type names like varchar
- Keep the supported-type list handy when authoring plans by hand
When it happens
Trigger: A plan field entry missing fieldType or setting it to ""/null. Commonly the field object only carried fieldName/fieldDesc/fieldJson.
Common situations: Plans generated from DB schemas where the SQL-to-Go type mapping step was skipped; users writing SQL types like varchar or bigint directly instead of the supported Go-side type names.
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
- 模块 %d 的 tableName 不能为空
- 模块 %d 的 description 不能为空
- 模块 %d 的 abbreviation 不能为空
- 模块 %d 的 packageName 不能为空
- 模块 %d 的 humpPackageName 不能为空
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/e05a554667880317.
Report an issue: GitHub.