{"record":{"id":"5e23801216b479b6","repo":"flipped-aurora/gin-vue-admin","slug":"autocode-module-is-empty","errorCode":null,"errorMessage":"autocode module is empty","messagePattern":"autocode module is empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/service/system/auto_code_plugin.go","lineNumber":353,"sourceCode":"\tif _, err = os.Stat(target); err == nil {\n\t\treturn errors.New(\"plugin already exists\")\n\t} else if !os.IsNotExist(err) {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc copyPluginArchive(sourceRoot, destinationRoot string) error {\n\tif err := os.MkdirAll(destinationRoot, 0755); err != nil {\n\t\treturn err\n\t}\n\treturn cp.Copy(sourceRoot, destinationRoot, cp.Options{Skip: skipMacSpecialDocument})\n}\n\nfunc prepareSubPluginSource(childPath, parentPlugin, childPlugin string) error {\n\tmodule := strings.TrimSpace(global.GVA_CONFIG.AutoCode.Module)\n\tif module == \"\" {\n\t\treturn errors.New(\"autocode module is empty\")\n\t}\n\toldImportPrefix := fmt.Sprintf(\"%s/plugin/%s\", module, childPlugin)\n\tnewImportPrefix := fmt.Sprintf(\"%s/plugin/%s/subPlugin/%s\", module, parentPlugin, childPlugin)\n\terr := filepath.Walk(childPath, func(path string, info os.FileInfo, walkErr error) error {\n\t\tif walkErr != nil {\n\t\t\treturn walkErr\n\t\t}\n\t\tif info.IsDir() || filepath.Ext(path) != \".go\" {\n\t\t\treturn nil\n\t\t}\n\t\treturn rewriteGoImportPaths(path, oldImportPrefix, newImportPrefix)\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tentryPath := filepath.Join(childPath, \"plugin.go\")\n\tif err = suppressSubPluginSelfRegistration(entryPath); err != nil {\n\t\treturn err","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/service/system/auto_code_plugin.go#L335-L371","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (config.yaml)\nautoCode:\n  module: \"\"\n// after\nautoCode:\n  module: \"github.com/your-org/your-project\"","handlingStrategy":"validation","validationCode":"if (strings.TrimSpace(global.GVA_CONFIG.AutoCode.Module) == \"\") {\n  return errors.New(\"autoCode.module must be set before installing sub-plugins\")\n}","typeGuard":null,"tryCatchPattern":"if err := installSubPlugin(parent, child); err != nil {\n  if strings.Contains(err.Error(), \"autocode module is empty\") {\n    log.Fatal(\"set autoCode.module in config and restart the server\")\n  }\n  return err\n}","preventionTips":["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."],"tags":["config","plugin-install","autocode"],"backgroundTag":"missing-config-value","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}