{"record":{"id":"12ec4881d9ccbb0d","repo":"thedotmack/claude-mem","slug":"uninstall-could-not-remove-plugindatadir","errorCode":null,"errorMessage":"[uninstall] Could not remove ${pluginDataDir}:","messagePattern":"\\[uninstall\\] Could not remove (.+?):","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/npx-cli/commands/uninstall.ts","lineNumber":232,"sourceCode":"        if (!entry.startsWith('mcp-logs-plugin-claude-mem-')) continue;\n        const logPath = join(projectPath, entry);\n        try {\n          rmSync(logPath, { recursive: true, force: true });\n          removedCount++;\n        } catch (error: unknown) {\n          console.warn(`[uninstall] Could not remove ${logPath}:`, error instanceof Error ? error.message : String(error));\n        }\n      }\n    }\n  }\n\n  const pluginDataDir = join(home, '.claude', 'plugins', 'data', 'claude-mem-thedotmack');\n  if (existsSync(pluginDataDir)) {\n    try {\n      rmSync(pluginDataDir, { recursive: true, force: true });\n      removedCount++;\n    } catch (error: unknown) {\n      console.warn(`[uninstall] Could not remove ${pluginDataDir}:`, error instanceof Error ? error.message : String(error));\n    }\n  }\n\n  return removedCount;\n}\n\nexport async function runUninstallCommand(): Promise<void> {\n  p.intro(styleText(['bgRed', 'white'], ' claude-mem uninstall '));\n\n  if (!isPluginInstalled()) {\n    p.log.warn('claude-mem does not appear to be installed.');\n\n    if (process.stdin.isTTY) {\n      const shouldCleanup = await p.confirm({\n        message: 'Clean up any remaining registration data anyway?',\n        initialValue: false,\n      });\n","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/e2d1df569a8f04075d40e92461128ece7cf04c82/src/npx-cli/commands/uninstall.ts#L214-L250","documentation":"At the end of the stray-path sweep, uninstall runs rmSync(recursive, force) on ~/.claude/plugins/data/claude-mem-thedotmack (plugin data). If the removal throws, it warns and uninstall continues, so the plugin data directory survives. This is separate from ~/.claude-mem (user memory data), which uninstall intentionally preserves.","triggerScenarios":"`npx claude-mem uninstall` when the plugin data directory is locked by a running Claude or plugin process (EBUSY/EPERM on Windows) or contains root-owned files.","commonSituations":"Uninstalling while Claude Code still has the plugin loaded; plugin data written under sudo; antivirus scanning the directory during removal.","solutions":["Close Claude Code so the plugin unloads, then re-run `npx claude-mem uninstall`","Fix ownership: sudo chown -R $(whoami) ~/.claude/plugins/data","Remove it manually: rm -rf ~/.claude/plugins/data/claude-mem-thedotmack"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { accessSync, constants } from 'node:fs';\nconst dataDir = `${process.env.HOME}/.claude/plugins/data/claude-mem-thedotmack`;\ntry { accessSync(dataDir, constants.W_OK); }\ncatch { /* close Claude Code so the plugin unloads, then re-run uninstall */ }","typeGuard":"function isErrnoException(error: unknown): error is NodeJS.ErrnoException {\n  return error instanceof Error && typeof (error as NodeJS.ErrnoException).code === 'string';\n}","tryCatchPattern":null,"preventionTips":["Close Claude Code before uninstalling so the plugin data dir is not locked","Never let the plugin write data under sudo; fix with sudo chown -R $(whoami) ~/.claude/plugins/data","Distinguish this dir from ~/.claude-mem, which uninstall intentionally preserves"],"tags":["uninstall","plugin-data","file-delete","process-lock"],"backgroundTag":"file-delete-permission-denied","analyzedSha":"e2d1df569a8f04075d40e92461128ece7cf04c82","analyzedAt":"2026-08-20T23:58:13.836Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}