{"record":{"id":"1d4b110fbffa1432","repo":"ipfs/kubo","slug":"closing-plugins-w","errorCode":null,"errorMessage":"closing plugins: %w","messagePattern":"closing plugins: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/ipfs/kubo/daemon.go","lineNumber":616,"sourceCode":"\t\treturn node, nil\n\t}\n\n\t// Start \"core\" plugins. We want to do this *before* starting the HTTP\n\t// API as the user may be relying on these plugins.\n\terr = cctx.Plugins.Start(node)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpluginErrc := make(chan error, 1)\n\tselect {\n\tcase <-node.Context().Done():\n\t\tclose(pluginErrc)\n\tdefault:\n\t\tcontext.AfterFunc(node.Context(), func() {\n\t\t\terr := cctx.Plugins.Close()\n\t\t\tif err != nil {\n\t\t\t\tpluginErrc <- fmt.Errorf(\"closing plugins: %w\", err)\n\t\t\t}\n\t\t\tclose(pluginErrc)\n\t\t})\n\t}\n\n\t// construct api endpoint - every time\n\tapiErrc, err := serveHTTPApi(req, cctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// construct fuse mountpoints - if the user provided the --mount flag\n\tmount, _ := req.Options[mountKwd].(bool)\n\tif mount && offline {\n\t\treturn cmds.Errorf(cmds.ErrClient, \"mount is not currently supported in offline mode\")\n\t}\n\tif mount {\n\t\tif err := mountFuse(req, cctx); err != nil {","sourceCodeStart":598,"sourceCodeEnd":634,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/cmd/ipfs/kubo/daemon.go#L598-L634","documentation":"When the daemon node's context is cancelled during shutdown, kubo closes loaded plugins in an AfterFunc and wraps any Close() error with this message on the plugin error channel. It signals a plugin failed to release resources cleanly at shutdown.","triggerScenarios":"Daemon shutdown while a plugin's Close() method returns an error (e.g. plugin holding open datastore/file handles or a failing teardown hook).","commonSituations":"Custom plugins with buggy teardown logic; plugin panics or timeouts during close; shutdown during heavy plugin activity.","solutions":["Inspect the wrapped inner error to identify which plugin failed","Update or remove the misbehaving plugin from the plugins directory","Report upstream if it is a bundled plugin; ensure plugin Close() is idempotent and error-free"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// consume the daemon shutdown error channel\nif err := <-pluginErrc; err != nil {\n    var wrapped *fmt.wrapError\n    if errors.As(err, &wrapped) {\n        log.Warnf(\"plugin shutdown issue: %v\", errors.Unwrap(err))\n    }\n}","preventionTips":["Keep custom plugin Close() implementations simple and idempotent","Test plugin teardown under daemon restart loops"],"tags":["ipfs","kubo","plugin","shutdown","lifecycle"],"backgroundTag":"plugin-close-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"}