flipped-aurora/gin-vue-admin · error
autocode module is empty
Error message
autocode module is empty
What it means
Rewriting a sub-plugin's Go import paths requires the AutoCode module name from configuration (the Go module of generated code). prepareSubPluginSource reads `global.GVA_CONFIG.AutoCode.Module` and, when it is empty or whitespace, cannot compute the old/new import prefixes and throws this error before any file rewriting happens.
Source
Thrown at server/service/system/auto_code_plugin.go:353
if _, err = os.Stat(target); err == nil {
return errors.New("plugin already exists")
} else if !os.IsNotExist(err) {
return err
}
return nil
}
func copyPluginArchive(sourceRoot, destinationRoot string) error {
if err := os.MkdirAll(destinationRoot, 0755); err != nil {
return err
}
return cp.Copy(sourceRoot, destinationRoot, cp.Options{Skip: skipMacSpecialDocument})
}
func prepareSubPluginSource(childPath, parentPlugin, childPlugin string) error {
module := strings.TrimSpace(global.GVA_CONFIG.AutoCode.Module)
if module == "" {
return errors.New("autocode module is empty")
}
oldImportPrefix := fmt.Sprintf("%s/plugin/%s", module, childPlugin)
newImportPrefix := fmt.Sprintf("%s/plugin/%s/subPlugin/%s", module, parentPlugin, childPlugin)
err := filepath.Walk(childPath, func(path string, info os.FileInfo, walkErr error) error {
if walkErr != nil {
return walkErr
}
if info.IsDir() || filepath.Ext(path) != ".go" {
return nil
}
return rewriteGoImportPaths(path, oldImportPrefix, newImportPrefix)
})
if err != nil {
return err
}
entryPath := filepath.Join(childPath, "plugin.go")
if err = suppressSubPluginSelfRegistration(entryPath); err != nil {
return errView on GitHub (pinned to 3136500ef3)
Solutions
- Set `autoCode.module` in the server config to the actual Go module path of your generated code (e.g. github.com/org/project).
- Restart the server so the new config value is loaded into global.GVA_CONFIG.
- If config is injected via environment variables, confirm the variable mapping for the module key is present and non-empty.
Example fix
// before (config.yaml) autoCode: module: "" // after autoCode: module: "github.com/your-org/your-project"
Defensive patterns
Strategy: validation
Validate before calling
if (strings.TrimSpace(global.GVA_CONFIG.AutoCode.Module) == "") {
return errors.New("autoCode.module must be set before installing sub-plugins")
} Try / catch
if err := installSubPlugin(parent, child); err != nil {
if strings.Contains(err.Error(), "autocode module is empty") {
log.Fatal("set autoCode.module in config and restart the server")
}
return err
} Prevention
- Set autoCode.module during initial environment setup, not on demand.
- Add a startup config assertion that fails fast when the module is blank.
- Keep a checked-in config template with the module placeholder filled for each environment.
When it happens
Trigger: Calling the sub-plugin install API while `autoCode.module` in the server config is unset, empty string, or only whitespace; running with a config file that omits the autoCode section entirely.
Common situations: Fresh deployment where the autoCode config block was never filled in; config trimmed down for production and the module key dropped; environment-variable-driven config overriding the value to empty; copying a config template without editing it.
Related errors
- autocode根路径未配置
- 请先前往插件市场个人中心获取 AiPath 并填写到 config.yaml 中
- 自动代码目标不在服务端或前端目录内: %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/5e23801216b479b6.
Report an issue: GitHub.