{"record":{"id":"77fbf7b1983252ef","repo":"flipped-aurora/gin-vue-admin","slug":"autocode","errorCode":null,"errorMessage":"autocode根路径未配置","messagePattern":"autocode根路径未配置","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/gva_analyze.go","lineNumber":364,"sourceCode":"\t}\n\n\t// 这里可以根据需要实现具体的API和菜单清理逻辑\n\t// 由于涉及到具体的业务逻辑，这里只做日志记录\n\tlogger.WithCtx(ctx).Mod(\"mcp\").Info(fmt.Sprintf(\"清理历史记录ID %v 相关的API和菜单记录\", historyIDs))\n\n\t// 可以调用service层的相关方法进行清理\n\t// 例如：service.ServiceGroupApp.SystemApiService.DeleteApisByIds(historyIDs)\n\t// 例如：service.ServiceGroupApp.MenuService.DeleteMenusByIds(historyIDs)\n\n\treturn nil\n}\n\n// scanPredesignedModules 扫描预设计模块\nfunc (g *GVAAnalyzer) scanPredesignedModules(ctx context.Context) ([]PredesignedModuleInfo, error) {\n\t// 获取autocode配置路径\n\tautocodeRoot := global.GVA_CONFIG.AutoCode.Root\n\tif autocodeRoot == \"\" {\n\t\treturn nil, errors.New(\"autocode根路径未配置\")\n\t}\n\n\tvar modules []PredesignedModuleInfo\n\n\t// 扫描plugin目录\n\tpluginModules, err := g.scanPluginModules(ctx, filepath.Join(autocodeRoot, global.GVA_CONFIG.AutoCode.Server, \"plugin\"))\n\tif err != nil {\n\t\tlogger.WithCtx(ctx).Mod(\"mcp\").Err(err).Warn(\"扫描plugin模块失败\")\n\t} else {\n\t\tmodules = append(modules, pluginModules...)\n\t}\n\n\t// 扫描model目录\n\tmodelModules, err := g.scanModelModules(ctx, filepath.Join(autocodeRoot, global.GVA_CONFIG.AutoCode.Server, \"model\"))\n\tif err != nil {\n\t\tlogger.WithCtx(ctx).Mod(\"mcp\").Err(err).Warn(\"扫描model模块失败\")\n\t} else {\n\t\tmodules = append(modules, modelModules...)","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/gva_analyze.go#L346-L382","documentation":"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.","triggerScenarios":"Running performAnalysis-driven MCP analysis on a server whose config.yaml lacks the autocode.root key or has it set to \"\".","commonSituations":"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.","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."],"exampleFix":"// before (config.yaml)\nauto-code:\n  root: \"\"\n// after (config.yaml)\nauto-code:\n  root: \"/path/to/gin-vue-admin/server\"","handlingStrategy":"validation","validationCode":"if (global.GVA_CONFIG.AutoCode.Root == \"\") {\n  return fmt.Errorf(\"autocode root must be set in config.yaml (auto-code.root) before analysis\")\n}","typeGuard":null,"tryCatchPattern":"modules, err := analyzer.scanPredesignedModules(ctx)\nif err != nil {\n  if err.Error() == \"autocode根路径未配置\" {\n    // surface a config-fix message instead of a stack trace\n    return nil, fmt.Errorf(\"set auto-code.root in config.yaml: %w\", err)\n  }\n  return nil, err\n}","preventionTips":["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."],"tags":["config","autocode","missing-env-var"],"backgroundTag":"missing-config-value","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}