{"record":{"id":"3186685106b223e6","repo":"ipfs/kubo","slug":"error-initializing-plugins-s","errorCode":null,"errorMessage":"error initializing plugins: %s","messagePattern":"error initializing plugins: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/ipfs/kubo/start.go","lineNumber":90,"sourceCode":"\theapProfile        = \"ipfs.memprof\"\n)\n\ntype PluginPreloader func(*loader.PluginLoader) error\n\nfunc loadPlugins(repoPath string, preload PluginPreloader) (*loader.PluginLoader, error) {\n\tplugins, err := loader.NewPluginLoader(repoPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error loading plugins: %s\", err)\n\t}\n\n\tif preload != nil {\n\t\tif err := preload(plugins); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error loading plugins (preload): %s\", err)\n\t\t}\n\t}\n\n\tif err := plugins.Initialize(); err != nil {\n\t\treturn nil, fmt.Errorf(\"error initializing plugins: %s\", err)\n\t}\n\n\tif err := plugins.Inject(); err != nil {\n\t\treturn nil, fmt.Errorf(\"error initializing plugins: %s\", err)\n\t}\n\treturn plugins, nil\n}\n\nfunc printErr(err error) int {\n\tfmt.Fprintf(os.Stderr, \"Error: %s\\n\", err.Error())\n\treturn 1\n}\n\nfunc BuildDefaultEnv(ctx context.Context, req *cmds.Request) (cmds.Environment, error) {\n\treturn BuildEnv(nil)(ctx, req)\n}\n\n// BuildEnv creates an environment to be used with the kubo CLI. Note: the plugin preloader should only call functions","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/cmd/ipfs/kubo/start.go#L72-L108","documentation":"Thrown by loadPlugins when plugins.Initialize() fails — the phase that runs each discovered plugin's Init with plugin context/process info. A plugin returning an error from its Init (or crashing the init pass) aborts daemon startup. The plugin loader guarantees all plugins initialize or none proceed.","triggerScenarios":"Daemon startup with a plugin whose Init returns an error: duplicate plugin names, plugin type registration conflicts, or plugin code failing on its internal setup. Also triggered by corrupted/incompatible .so files that fail during initialization.","commonSituations":"Two copies of the same plugin in the plugins dir; a plugin compiled against a different kubo/plugin API version; plugins requiring environment (paths, files) not present in the container.","solutions":["Read the wrapped error to identify the failing plugin and remove it from <IPFS_PATH>/plugins, then restart.","Deduplicate: remove duplicate copies of the same plugin from the plugins directory.","Rebuild the plugin against the exact kubo/plugin API version of your binary; plugin .so files must match the kubo version they were built for.","Run with GOLOG_LOG_LEVEL=debug for a more precise failure point if the wrapped error is vague."],"exampleFix":"// before\n~/.ipfs/plugins/myplugin.so  built against kubo v0.20\n// after\nrebuild plugin against the current kubo version and replace the .so","handlingStrategy":"try-catch","validationCode":"// before daemon start, check for duplicate plugin files\nseen := map[string]struct{}{}\nentries, _ := os.ReadDir(filepath.Join(repoPath, \"plugins\"))\nfor _, e := range entries {\n\tif _, dup := seen[e.Name()]; dup {\n\t\tlog.Fatalf(\"duplicate plugin %s in %s/plugins\", e.Name(), repoPath)\n\t}\n\tseen[e.Name()] = struct{}{}\n}","typeGuard":null,"tryCatchPattern":"plugins, err := loadPlugins(repoPath, preload)\nif err != nil && strings.Contains(err.Error(), \"initializing plugins\") {\n\tlog.Printf(\"plugin Init failed: %v — remove the offending plugin from %s/plugins\", err, repoPath)\n\treturn err\n}","preventionTips":["Keep exactly one copy of each plugin in the plugins directory","Rebuild plugins for the exact kubo version; .so plugins are not portable across versions","Run the daemon with GOLOG_LOG_LEVEL=debug while installing new plugins"],"tags":["plugins","daemon","startup"],"backgroundTag":"plugin-load-failed","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}