flipped-aurora/gin-vue-admin · error
parent plugin does not implement Register
Error message
parent plugin does not implement Register
What it means
To register a child sub-plugin, the parent's plugin.go must expose a `Register` function (the installer locates it via findPluginRegisterFunction). If no such function exists in the parent's AST, the installer cannot append the child registration call and throws this error, meaning the parent is not a properly structured plugin entry.
Source
Thrown at server/service/system/auto_code_plugin.go:618
return errors.New("child plugin import cannot be blank or dot imported")
}
if !imported {
importSpec := &goast.ImportSpec{
Name: goast.NewIdent(alias),
Path: &goast.BasicLit{Kind: token.STRING, Value: strconv.Quote(childImportPath)},
}
if importDecl := firstImportDeclaration(astFile); importDecl == nil {
astFile.Decls = append([]goast.Decl{
&goast.GenDecl{Tok: token.IMPORT, Specs: []goast.Spec{importSpec}},
}, astFile.Decls...)
} else {
importDecl.Specs = append(importDecl.Specs, importSpec)
}
}
registerFunc := findPluginRegisterFunction(astFile)
if registerFunc == nil {
return errors.New("parent plugin does not implement Register")
}
if hasChildPluginRegisterCall(registerFunc.Body, alias) {
return nil
}
groupName := "group"
if registerFunc.Type.Params != nil && len(registerFunc.Type.Params.List) > 0 && len(registerFunc.Type.Params.List[0].Names) > 0 {
groupName = registerFunc.Type.Params.List[0].Names[0].Name
}
registerFunc.Body.List = append(registerFunc.Body.List, &goast.ExprStmt{
X: &goast.CallExpr{
Fun: &goast.SelectorExpr{
X: &goast.SelectorExpr{X: goast.NewIdent(alias), Sel: goast.NewIdent("Plugin")},
Sel: goast.NewIdent("Register"),
},
Args: []goast.Expr{goast.NewIdent(groupName)},
},
})
return writeGoFile(parentPath, fileSet, astFile)View on GitHub (pinned to 3136500ef3)
Solutions
- Add a standard `Register(group *gin.RouterGroup)` function to the parent's plugin.go, delegating to any existing route setup.
- Move or restore the Register function into plugin.go so the installer can find it in that file's AST.
- Rename a non-standard entry function (e.g. SetupRoutes) back to Register with the expected signature.
- Verify the parent was generated as a real plugin (via the code generator or template) rather than an empty directory with a stub plugin.go.
Example fix
// before (parent plugin.go)
package parent
// no Register function
// after
package parent
import "github.com/gin-gonic/gin"
func Register(group *gin.RouterGroup) {
// parent routes...
} Defensive patterns
Strategy: validation
Validate before calling
// precheck that parent plugin.go defines Register
src, _ := os.ReadFile(path.Join(pluginRoot, parent, "plugin.go"))
if !strings.Contains(string(src), "func Register(") {
return errors.New("parent plugin.go must define func Register(group *gin.RouterGroup)")
} Try / catch
if err := installSubPlugin(parent, child); err != nil {
if strings.Contains(err.Error(), "does not implement Register") {
log.Fatal("add func Register(group *gin.RouterGroup) to the parent's plugin.go")
}
return err
} Prevention
- Generate parent plugins with the standard template so Register always exists.
- Do not rename or move the Register function out of plugin.go during refactors.
- Keep parent plugins minimal scaffolds that delegate, so the entry contract stays intact.
When it happens
Trigger: Installing a sub-plugin under a parent whose plugin.go lacks a `Register` function — e.g. the parent was hand-created without the standard plugin scaffold, or the Register function is defined in another file/package, or it was renamed.
Common situations: Parent generated from an old template with a differently-named entry function; developer refactored Register away or moved it; plugin.go replaced by a minimal stub; parent actually a plain library directory mislabeled as a plugin.
Related errors
- child plugin import cannot be blank or dot imported
- server and web plugin names must match
- plugin archive contains multiple server plugins
- plugin archive contains multiple web plugins
- invalid plugin archive
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/2e6de53c0a7f9a5a.
Report an issue: GitHub.