{"record":{"id":"66334509e3d840cc","repo":"can1357/oh-my-pi","slug":"plugin-pluginid-is-not-installed-in-user-scop","errorCode":null,"errorMessage":"Plugin \"${pluginId}\" is not installed in user scope","messagePattern":"Plugin \"(.+?)\" is not installed in user scope","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/extensibility/plugins/marketplace/manager.ts","lineNumber":471,"sourceCode":"\t\tconst inUser = userEntries && userEntries.length > 0;\n\t\tconst inProject = projectEntries && projectEntries.length > 0;\n\n\t\tif (!inUser && !inProject) {\n\t\t\tthrow new Error(`Plugin \"${pluginId}\" is not installed`);\n\t\t}\n\n\t\t// Disambiguation: if installed in both scopes and no explicit scope, require one.\n\t\tlet targetScope: \"user\" | \"project\";\n\t\tif (inUser && inProject) {\n\t\t\tif (!scope) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Plugin \"${pluginId}\" is installed in both user and project scope. Use --scope user or --scope project to specify which to remove.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\ttargetScope = scope;\n\t\t} else if (inProject) {\n\t\t\tif (scope === \"user\") {\n\t\t\t\tthrow new Error(`Plugin \"${pluginId}\" is not installed in user scope`);\n\t\t\t}\n\t\t\ttargetScope = \"project\";\n\t\t} else {\n\t\t\tif (scope === \"project\") {\n\t\t\t\tthrow new Error(`Plugin \"${pluginId}\" is not installed in project scope`);\n\t\t\t}\n\t\t\ttargetScope = \"user\";\n\t\t}\n\n\t\tconst targetEntries = targetScope === \"project\" ? projectEntries! : userEntries!;\n\t\tconst targetReg = targetScope === \"project\" ? projectReg : userReg;\n\t\tconst registryPath = this.#registryPath(targetScope);\n\t\tconst packageNames = await this.#resolveInstalledPackageNames(targetEntries, parsed.name);\n\n\t\tif (options?.dryRun) {\n\t\t\treturn;\n\t\t}\n","sourceCodeStart":453,"sourceCodeEnd":489,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/extensibility/plugins/marketplace/manager.ts#L453-L489","documentation":"During scope resolution, if the plugin is installed only in project scope but the caller explicitly requested scope \"user\", uninstallPlugin throws this mismatch error rather than silently uninstalling nothing or targeting the wrong scope. (The mirror error exists for scope \"project\" when only user-scope install exists.)","triggerScenarios":"uninstallPlugin(pluginId, \"user\") where #findInBothRegistries found entries only in the project registry (inProject true, inUser false).","commonSituations":"CLI users passing --scope user out of habit when the plugin was project-installed; automation hardcoding one scope; a teammate installed the plugin at project level but you assumed it was your user-level install.","solutions":["Retry with the matching scope: uninstallPlugin(pluginId, \"project\")","Omit the scope if only one installation exists and you want that one removed","Confirm the installation scope via the plugin list before specifying --scope","If you intended a user-scope install, install it at user scope first — there is nothing at user scope to remove"],"exampleFix":"// before\nawait manager.uninstallPlugin(\"formatter@community\", \"user\");\n// after\nawait manager.uninstallPlugin(\"formatter@community\", \"project\"); // plugin is project-scoped only","handlingStrategy":"validation","validationCode":"const inUser = (await manager.listInstalledPlugins(\"user\")).some(p => p.id === pluginId);\nconst inProject = (await manager.listInstalledPlugins(\"project\")).some(p => p.id === pluginId);\nif (!inUser && !inProject) return; // nothing installed\nawait manager.uninstallPlugin(pluginId, inUser ? \"user\" : \"project\");","typeGuard":null,"tryCatchPattern":"try {\n  await manager.uninstallPlugin(pluginId, scope);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"is not installed in\")) {\n    // wrong scope requested; fall back to the scope that actually has it\n    await manager.uninstallPlugin(pluginId, err.message.includes(\"user scope\") ? \"project\" : \"user\");\n  } else throw err;\n}","preventionTips":["Derive the scope from where the plugin actually exists instead of hardcoding it","Check the per-scope plugin list before passing --scope","Use one consistent scope convention across your team's setup scripts","Treat \"not installed in X scope\" as a signal to inspect both registries, not to retry blindly"],"tags":["plugin-marketplace","scope-mismatch","uninstall"],"backgroundTag":"plugin-not-installed-in-scope","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}