{"record":{"id":"794095ce6334d22c","repo":"m1k1o/neko","slug":"not-a-valid-plugin","errorCode":null,"errorMessage":"not a valid plugin","messagePattern":"not a valid plugin","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/plugins/manager.go","lineNumber":92,"sourceCode":"\t\tmanager.logger.Err(err).Str(\"plugin\", path).Msg(\"loading a plugin\")\n\t\treturn nil\n\t})\n}\n\nfunc (manager *ManagerCtx) load(path string) error {\n\tpl, err := plugin.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsym, err := pl.Lookup(\"Plugin\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp, ok := sym.(types.Plugin)\n\tif !ok {\n\t\treturn fmt.Errorf(\"not a valid plugin\")\n\t}\n\n\tif err = manager.plugins.addPlugin(p); err != nil {\n\t\treturn fmt.Errorf(\"failed to add plugin: %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc (manager *ManagerCtx) InitConfigs(cmd *cobra.Command) {\n\t_ = manager.plugins.forEach(func(d *dependency) error {\n\t\tif err := d.plugin.Config().Init(cmd); err != nil {\n\t\t\tlog.Err(err).Str(\"plugin\", d.plugin.Name()).Msg(\"unable to initialize configuration\")\n\t\t}\n\t\treturn nil\n\t})\n}\n","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/m1k1o/neko/blob/b0f01cedea68893e85a3fd852c0521238c285695/server/internal/plugins/manager.go#L74-L110","documentation":"Returned by Manager.load when a plugin binary/so file loads and its exported symbol resolves, but the resulting symbol does not implement the types.Plugin interface. load only accepts objects satisfying types.Plugin (Name, Start, Shutdown etc.); anything else is rejected with this error.","triggerScenarios":"Loading a .so whose exported entry symbol returns a value that is not a types.Plugin — e.g. a shared library built for a different product, a Go plugin compiled without the required interface methods, or a symbol type change after an API upgrade.","commonSituations":"Mixing plugin .so files built against a different server version where types.Plugin's method set changed; loading an arbitrary .so by mistake in the plugin dir; a custom plugin that implements most but not all Plugin interface methods.","solutions":["Rebuild the plugin against the exact server version's types.Plugin interface (same module version) and reload","Verify the plugin implements every method of types.Plugin (Name, Start, Shutdown, ...) on the exported type","Confirm the plugin file is the intended artifact for this product, not another plugin binary","Check the exported symbol path/registry key matches what load expects"],"exampleFix":"// before\ntype myPlugin struct{}\nfunc (p *myPlugin) Name() string { return \"my\" }\n// missing Start/Shutdown -> \"not a valid plugin\"\n\n// after\ntype myPlugin struct{}\nfunc (p *myPlugin) Name() string { return \"my\" }\nfunc (p *myPlugin) Start() error   { return nil }\nfunc (p *myPlugin) Shutdown() error { return nil }\nvar _ types.Plugin = (*myPlugin)(nil) // compile-time check","handlingStrategy":"type-guard","validationCode":"// build-time guarantee\nvar _ types.Plugin = (*myPlugin)(nil)\n\n// load-time pre-check\nsym, err := lookupSymbol(so)\nif err != nil { return err }\nif _, ok := sym.(types.Plugin); !ok {\n    return fmt.Errorf(\"artifact %s does not implement types.Plugin\", soPath)\n}","typeGuard":"func asPlugin(sym any) (types.Plugin, bool) {\n    p, ok := sym.(types.Plugin)\n    return p, ok\n}","tryCatchPattern":"if err := manager.load(soPath); err != nil {\n    if err.Error() == \"not a valid plugin\" {\n        log.Error().Str(\"file\", soPath).Msg(\"rebuild plugin against current server types.Plugin\")\n    }\n    return err\n}","preventionTips":["Compile plugins against the same module version as the server; pin versions together","Add `var _ types.Plugin = (*Plugin)(nil)` in every plugin to fail at compile time","Only place verified plugin artifacts in the plugin directory; checksum them in CI"],"tags":["go","plugins","type-assertion","interface"],"backgroundTag":"plugin-interface-mismatch","analyzedSha":"b0f01cedea68893e85a3fd852c0521238c285695","analyzedAt":"2026-09-01T10:35:56.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}