{"record":{"id":"8286c70304f88c2e","repo":"siyuan-note/siyuan","slug":"plugin-s-not-found","errorCode":null,"errorMessage":"plugin [%s] not found","messagePattern":"plugin \\[(.+?)\\] not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/plugin.go","lineNumber":69,"sourceCode":"type KernelPetal struct {\n\tJS           string `json:\"js\"`           // Kernel JS code\n\tExisted      bool   `json:\"existed\"`      // Whether kernel.js is exist\n\tIncompatible bool   `json:\"incompatible\"` // Whether incompatible\n}\n\nvar (\n\tOnKernelPluginStart  func(petal *Petal) // Called when a plugin is enabled (after loading and starting the plugin)\n\tOnKernelPluginStop   func(petal *Petal) // Called when a plugin is disabled (before stopping and unloading the plugin)\n\tOnKernelPluginsStart func()             // Called to start all valid plugins\n\tOnKernelPluginsStop  func()             // Called to stopping all valid plugins\n)\n\nfunc SetPetalEnabled(name string, enabled bool) (ret *Petal, err error) {\n\tpetals := getPetals()\n\n\tfound, version, displayName, incompatible, disabledInPublish, disallowInstall, kernelIncompatible := bazaar.ParseInstalledPlugin(name, \"\")\n\tif !found {\n\t\terr = fmt.Errorf(\"plugin [%s] not found\", name)\n\t\tlogging.LogErrorf(\"%s\", err)\n\t\treturn\n\t}\n\n\tret = getPetalByName(name, petals)\n\tif nil == ret {\n\t\tret = &Petal{\n\t\t\tName: name,\n\t\t}\n\t\tpetals = append(petals, ret)\n\t}\n\tret.Version = version\n\tret.DisplayName = displayName\n\tret.Enabled = enabled\n\tret.Incompatible = incompatible\n\tret.DisabledInPublish = disabledInPublish\n\tret.DisallowInstall = disallowInstall\n\tret.Kernel = KernelPetal{","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/plugin.go#L51-L87","documentation":"Thrown by SetPetalEnabled() when bazaar.ParseInstalledPlugin(name, \"\") reports the plugin is not found (found=false). ParseInstalledPlugin inspects the installed plugin directory and plugin.json manifest; if the named plugin does not exist on disk or its manifest cannot be parsed, the function returns found=false and this error is thrown.","triggerScenarios":"Calling SetPetalEnabled(name, enabled) where name does not match any installed plugin in the data/plugins/ directory. The plugin was never installed, was uninstalled, or its directory/manifest.json was corrupted or manually deleted.","commonSituations":"A plugin was removed from disk but the frontend still shows it in the UI. The plugin name has a typo or case mismatch. The plugin directory was cleaned/reset. A plugin was installed to a different workspace. The plugin's plugin.json manifest was renamed or corrupted.","solutions":["Reinstall the plugin from the SiYuan Bazaar marketplace.","Verify the plugin name matches the directory name under data/plugins/.","Check that the plugin's plugin.json manifest exists and is valid JSON.","In the calling code, verify the plugin is installed via bazaar.ParseInstalledPlugin before calling SetPetalEnabled."],"exampleFix":"// before\npetal, err := model.SetPetalEnabled(\"my-plugin\", true)\n\n// after\nfound, _, _, _, _, _, _ := bazaar.ParseInstalledPlugin(\"my-plugin\", \"\")\nif !found {\n    return errors.New(\"plugin not installed, please install from Bazaar first\")\n}\npetal, err := model.SetPetalEnabled(\"my-plugin\", true)","handlingStrategy":"validation","validationCode":"found, _, _, _, _, _, _ := bazaar.ParseInstalledPlugin(name, \"\")\nif !found {\n    return nil, fmt.Errorf(\"plugin [%s] is not installed; install it from Bazaar first\", name)\n}\npetal, err := model.SetPetalEnabled(name, enabled)","typeGuard":"func isPluginInstalled(name string) bool {\n    found, _, _, _, _, _, _ := bazaar.ParseInstalledPlugin(name, \"\")\n    return found\n}","tryCatchPattern":null,"preventionTips":["Verify plugin installation before calling SetPetalEnabled.","In the UI, disable the enable/disable toggle for uninstalled plugins.","Refresh the plugin list after install/uninstall operations."],"tags":["plugin","bazaar","config","validation"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}