{"record":{"id":"bb0876e0f01c1f8a","repo":"gotify/server","slug":"instance-not-found","errorCode":null,"errorMessage":"instance not found","messagePattern":"instance not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/manager.go","lineNumber":110,"sourceCode":"\t\treturn nil, err\n\t}\n\tfor _, user := range users {\n\t\tif err := manager.initializeForUser(*user); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn manager, nil\n}\n\n// ErrAlreadyEnabledOrDisabled is returned on SetPluginEnabled call when a plugin is already enabled or disabled.\nvar ErrAlreadyEnabledOrDisabled = errors.New(\"config is already enabled/disabled\")\n\n// SetPluginEnabled sets the plugins enabled state.\nfunc (m *Manager) SetPluginEnabled(pluginID uint, enabled bool) error {\n\tinstance, err := m.Instance(pluginID)\n\tif err != nil {\n\t\treturn errors.New(\"instance not found\")\n\t}\n\tconf, err := m.db.GetPluginConfByID(pluginID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif conf.Enabled == enabled {\n\t\treturn ErrAlreadyEnabledOrDisabled\n\t}\n\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tif enabled {\n\t\terr = instance.Enable()\n\t} else {\n\t\terr = instance.Disable()\n\t}","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/gotify/server/blob/14bfc256276775c425f988d621dccfe705de18ac/plugin/manager.go#L92-L128","documentation":"Manager.SetPluginEnabled in plugin/manager.go discards the underlying error from m.Instance(pluginID) and returns a generic 'instance not found' error when no loaded plugin instance matches the given pluginID. It fires when the caller supplies a plugin id that was never loaded or has been unloaded, masking whether the lookup failed for another reason.","triggerScenarios":"Thrown at plugin/manager.go:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the pluginID passed to SetPluginEnabled exists in the manager's loaded instances","Propagate or wrap the original error from m.Instance instead of replacing it, to distinguish lookup failures","Refresh the caller's plugin list; the plugin may have been removed or failed to load at startup"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"14bfc256276775c425f988d621dccfe705de18ac","analyzedAt":"2026-09-05T12:52:36.781Z","contentChangedAt":"2026-09-05T12:52:36.781Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}