flipped-aurora/gin-vue-admin · error
模块 %d 字段 %d 的 fieldType '%s' 不支持
Error message
模块 %d 字段 %d 的 fieldType '%s' 不支持
What it means
validateExecutionPlan restricts fieldType to a fixed whitelist of supported Go/JSON types (string, int, int64, float64, bool, time.Time, enum, picture, video, file, pictures, array, richtext, json). Any other value is rejected because the code generator has no template mapping for it.
Source
Thrown at server/mcp/gva_execute.go:375
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)
}
}
if field.DataSource != nil {
associationValue := field.DataSource.Association
if associationValue == 2 && field.FieldType != "array" {
logger.WithCtx(ctx).Mod("mcp").Info(fmt.Sprintf("module %d field %d association=2, force fieldType to array", moduleIndex+1, i+1))
moduleInfo.Fields[i].FieldType = "array"
}
if associationValue != 1 && associationValue != 2 {
return fmt.Errorf("模块 %d 字段 %d 的 dataSource.association 必须是 1 或 2", moduleIndex+1, i+1)
}View on GitHub (pinned to 3136500ef3)
Solutions
- Change fieldType to one of the whitelisted values closest to the intent (e.g. 'datetime' -> 'time.Time', 'text' -> 'richtext')
- Fix casing to match the whitelist exactly (lowercase 'string', 'bool')
- Check the validFieldTypes slice in server/mcp/gva_execute.go and the generator's supported types before authoring a plan
Example fix
// before
{"fieldJson":"createdAt","fieldType":"datetime","columnName":"created_at"}
// after
{"fieldJson":"createdAt","fieldType":"time.Time","columnName":"created_at"} Defensive patterns
Strategy: validation
Validate before calling
var validFieldTypes = []string{"string","int","int64","float64","bool","time.Time","enum","picture","video","file","pictures","array","richtext","json"}
if !slices.Contains(validFieldTypes, f.FieldType) { return fmt.Errorf("bad fieldType %q", f.FieldType) } Type guard
func isSupportedFieldType(t string) bool {
return slices.Contains([]string{"string","int","int64","float64","bool","time.Time","enum","picture","video","file","pictures","array","richtext","json"}, t)
} Prevention
- Keep a shared constant list of allowed types instead of free-form strings
- Normalize casing before submission
- Map SQL-ish type names (datetime, text) to supported Go types in your generator
When it happens
Trigger: Calling the gva_execute tool with a plan whose fields[m].fieldType is not in the whitelist (e.g. 'int32', 'float', 'String', 'datetime', 'text').
Common situations: Case mismatch ('String' vs 'string'); using SQL types ('varchar','datetime') instead of Go types; new field types added to the generator UI but not to the MCP validator's whitelist (or vice versa).
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- packageType 必须是 'package' 或 'plugin'
- packageInfo.template 必须是 'package' 或 'plugin'
- Package为空!
- 脚本类型不支持
- 工具类型不支持
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/6394b448ce8fe7d0.
Report an issue: GitHub.