flipped-aurora/gin-vue-admin · error
autocode根路径未配置
Error message
autocode根路径未配置
What it means
Thrown by GVAAnalyzer.scanPredesignedModules when global.GVA_CONFIG.AutoCode.Root is empty. The analyzer scans the autocode root directory for predesigned (plugin/template) modules and cannot proceed without a configured root path.
Source
Thrown at server/mcp/gva_analyze.go:364
}
// 这里可以根据需要实现具体的API和菜单清理逻辑
// 由于涉及到具体的业务逻辑,这里只做日志记录
logger.WithCtx(ctx).Mod("mcp").Info(fmt.Sprintf("清理历史记录ID %v 相关的API和菜单记录", historyIDs))
// 可以调用service层的相关方法进行清理
// 例如:service.ServiceGroupApp.SystemApiService.DeleteApisByIds(historyIDs)
// 例如:service.ServiceGroupApp.MenuService.DeleteMenusByIds(historyIDs)
return nil
}
// scanPredesignedModules 扫描预设计模块
func (g *GVAAnalyzer) scanPredesignedModules(ctx context.Context) ([]PredesignedModuleInfo, error) {
// 获取autocode配置路径
autocodeRoot := global.GVA_CONFIG.AutoCode.Root
if autocodeRoot == "" {
return nil, errors.New("autocode根路径未配置")
}
var modules []PredesignedModuleInfo
// 扫描plugin目录
pluginModules, err := g.scanPluginModules(ctx, filepath.Join(autocodeRoot, global.GVA_CONFIG.AutoCode.Server, "plugin"))
if err != nil {
logger.WithCtx(ctx).Mod("mcp").Err(err).Warn("扫描plugin模块失败")
} else {
modules = append(modules, pluginModules...)
}
// 扫描model目录
modelModules, err := g.scanModelModules(ctx, filepath.Join(autocodeRoot, global.GVA_CONFIG.AutoCode.Server, "model"))
if err != nil {
logger.WithCtx(ctx).Mod("mcp").Err(err).Warn("扫描model模块失败")
} else {
modules = append(modules, modelModules...)View on GitHub (pinned to 3136500ef3)
Solutions
- Set autocode.root in server config.yaml to the absolute autocode directory path (typically the repo's server root or configured template root).
- Verify the config actually loaded: check GVA_CONFIG.AutoCode.Root at runtime or via startup logging.
- If running via environment variables, ensure the AutoCode root override is provided and non-empty.
- Restart the server after editing config.yaml so the new value is picked up.
Example fix
// before (config.yaml) auto-code: root: "" // after (config.yaml) auto-code: root: "/path/to/gin-vue-admin/server"
Defensive patterns
Strategy: validation
Validate before calling
if (global.GVA_CONFIG.AutoCode.Root == "") {
return fmt.Errorf("autocode root must be set in config.yaml (auto-code.root) before analysis")
} Try / catch
modules, err := analyzer.scanPredesignedModules(ctx)
if err != nil {
if err.Error() == "autocode根路径未配置" {
// surface a config-fix message instead of a stack trace
return nil, fmt.Errorf("set auto-code.root in config.yaml: %w", err)
}
return nil, err
} Prevention
- Set auto-code.root in config.yaml during initial deployment.
- Add a startup check that logs/fails fast when AutoCode.Root is empty.
- Document the AutoCode config block in environment setup checklists.
- After editing config.yaml, restart the server so the value reloads.
When it happens
Trigger: Running performAnalysis-driven MCP analysis on a server whose config.yaml lacks the autocode.root key or has it set to "".
Common situations: Fresh deployments where the AutoCode section was never configured; config.yaml copied from a minimal template; config loaded via env overrides that blanked the value; running the analyzer outside the server working directory with a partial config.
Related errors
- 请先前往插件市场个人中心获取 AiPath 并填写到 config.yaml 中
- autocode module is empty
- 自动代码目标不在服务端或前端目录内: %s
- 未找到 MCP 独立配置文件,请在当前目录、cmd/mcp 目录或通过 -config / GVA_MCP_CONFIG
- 未能自动识别项目根目录,请在 MCP 配置中设置 autocode.root
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/77fbf7b1983252ef.
Report an issue: GitHub.