{"record":{"id":"be8201587c69038b","repo":"thedotmack/claude-mem","slug":"uninstall-could-not-read-cacheroot","errorCode":null,"errorMessage":"[uninstall] Could not read ${cacheRoot}:","messagePattern":"\\[uninstall\\] Could not read (.+?):","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/npx-cli/commands/uninstall.ts","lineNumber":202,"sourceCode":"    for (const hashDir of hashDirs) {\n      const candidate = join(npxRoot, hashDir, 'node_modules', 'claude-mem');\n      if (!existsSync(candidate)) continue;\n      try {\n        rmSync(candidate, { recursive: true, force: true });\n        removedCount++;\n      } catch (error: unknown) {\n        console.warn(`[uninstall] Could not remove ${candidate}:`, error instanceof Error ? error.message : String(error));\n      }\n    }\n  }\n\n  const cacheRoot = join(home, '.cache', 'claude-cli-nodejs');\n  if (existsSync(cacheRoot)) {\n    let projectDirs: string[] = [];\n    try {\n      projectDirs = readdirSync(cacheRoot);\n    } catch (error: unknown) {\n      console.warn(`[uninstall] Could not read ${cacheRoot}:`, error instanceof Error ? error.message : String(error));\n    }\n    for (const projectDir of projectDirs) {\n      const projectPath = join(cacheRoot, projectDir);\n      let logEntries: string[] = [];\n      try {\n        logEntries = readdirSync(projectPath);\n      } catch (error: unknown) {\n        console.warn(`[uninstall] Could not read ${projectPath}:`, error instanceof Error ? error.message : String(error));\n        continue;\n      }\n      for (const entry of logEntries) {\n        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));","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/e2d1df569a8f04075d40e92461128ece7cf04c82/src/npx-cli/commands/uninstall.ts#L184-L220","documentation":"removeStrayClaudeMemPaths() lists ~/.cache/claude-cli-nodejs (the Claude CLI per-project cache) to find mcp-logs-plugin-claude-mem-* entries. If readdirSync on the cache root fails, it warns with projectDirs empty and skips the entire MCP log cleanup sweep.","triggerScenarios":"`npx claude-mem uninstall` when ~/.cache/claude-cli-nodejs is unreadable (ownership or permission changes, XDG_CACHE_HOME oddities) or disappears mid-run.","commonSituations":"Cache directories created by a different user or by snap/flatpak-scoped Claude; permission resets on ~/.cache; home directories on network storage with intermittent access.","solutions":["Run sudo chown -R $(whoami) ~/.cache/claude-cli-nodejs and re-run uninstall","Or remove the logs manually: find ~/.cache/claude-cli-nodejs -maxdepth 2 -name 'mcp-logs-plugin-claude-mem-*' -exec rm -rf {} +","Ignore it: these are only stale MCP log directories"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { accessSync, constants } from 'node:fs';\nconst cacheRoot = `${process.env.HOME}/.cache/claude-cli-nodejs`;\ntry { accessSync(cacheRoot, constants.R_OK); }\ncatch { /* fix ownership of ~/.cache before uninstall or the log sweep is skipped */ }","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":["Keep ~/.cache user-owned, especially on machines where Claude ran under different credentials","Avoid running cleanup tools that delete cache contents while uninstall runs","Treat leftover mcp-logs dirs as harmless: they only waste disk"],"tags":["uninstall","cache-cleanup","filesystem"],"backgroundTag":"file-read-permission-denied","analyzedSha":"e2d1df569a8f04075d40e92461128ece7cf04c82","analyzedAt":"2026-08-20T23:58:13.836Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}