flipped-aurora/gin-vue-admin · error
apiGroup 参数是必需的
Error message
apiGroup 参数是必需的
What it means
Thrown by ApiCreator's Handle when the "apiGroup" argument is missing, empty, or not a string in single-API mode. apiGroup determines which API group (gin route group) the new API record belongs to.
Source
Thrown at server/mcp/api_creator.go:83
args := request.GetArguments()
var apis []ApiCreateRequest
if apisStr, ok := args["apis"].(string); ok && apisStr != "" {
if err := json.Unmarshal([]byte(apisStr), &apis); err != nil {
return nil, fmt.Errorf("apis 参数格式错误: %w", err)
}
} else {
path, ok := args["path"].(string)
if !ok || path == "" {
return nil, errors.New("path 参数是必需的")
}
description, ok := args["description"].(string)
if !ok || description == "" {
return nil, errors.New("description 参数是必需的")
}
apiGroup, ok := args["apiGroup"].(string)
if !ok || apiGroup == "" {
return nil, errors.New("apiGroup 参数是必需的")
}
method := "POST"
if value, ok := args["method"].(string); ok && value != "" {
method = value
}
apis = append(apis, ApiCreateRequest{
Path: path,
Description: description,
ApiGroup: apiGroup,
Method: method,
})
}
if len(apis) == 0 {
return nil, errors.New("没有要创建的API")
}View on GitHub (pinned to 3136500ef3)
Solutions
- Pass a non-empty "apiGroup" string matching an existing system API group (e.g. "user", "authority").
- Check the API groups already registered in the system (sys_apis) and reuse one of their names.
- If creating several APIs, move them into the "apis" JSON array argument where each object includes apiGroup.
Example fix
// before
{"arguments": {"path": "/user/list", "description": "获取用户列表"}}
// after
{"arguments": {"path": "/user/list", "description": "获取用户列表", "apiGroup": "user"}} Defensive patterns
Strategy: validation
Validate before calling
const apiGroup = args["apiGroup"]
if (typeof apiGroup !== "string" || apiGroup === "") {
throw new Error("apiGroup must be a non-empty string before calling api_creator")
} Type guard
function hasApiGroup(args) {
return typeof args.apiGroup === "string" && args.apiGroup.length > 0
} Try / catch
try {
await callTool("api_creator", { path, description, apiGroup })
} catch (e) {
if (e.message.includes("apiGroup 参数是必需的")) {
// resolve a valid group name and retry
}
} Prevention
- Fetch valid group names from the system API list and pass one explicitly.
- Never leave apiGroup blank hoping for a default — there is none.
- Keep a shared helper that constructs api_creator arguments with all required fields.
When it happens
Trigger: Invoking api_creator with "path" and "description" supplied but no "apiGroup" string, an empty string, or a non-string value.
Common situations: Agents unaware apiGroup is mandatory; callers confusing apiGroup with the optional "method" argument; group names lost when arguments are programmatically assembled.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- path 参数是必需的
- description 参数是必需的
- 参数错误:executionPlan 必须提供
- 参数错误:userRequirement 必须提供
- 参数错误:generatedFiles 必须提供
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/f7d78fcba55d69ae.
Report an issue: GitHub.