thedotmack/claude-mem · warning

[uninstall] Could not read ${projectPath}:

Error message

[uninstall] Could not read ${projectPath}:

What it means

Inside the cache sweep, each project directory under ~/.cache/claude-cli-nodejs is listed with readdirSync. If one project directory cannot be read, uninstall warns and continues with the next directory, so only that project's claude-mem MCP logs are left behind.

Source

Thrown at src/npx-cli/commands/uninstall.ts:210

      }
    }
  }

  const cacheRoot = join(home, '.cache', 'claude-cli-nodejs');
  if (existsSync(cacheRoot)) {
    let projectDirs: string[] = [];
    try {
      projectDirs = readdirSync(cacheRoot);
    } catch (error: unknown) {
      console.warn(`[uninstall] Could not read ${cacheRoot}:`, error instanceof Error ? error.message : String(error));
    }
    for (const projectDir of projectDirs) {
      const projectPath = join(cacheRoot, projectDir);
      let logEntries: string[] = [];
      try {
        logEntries = readdirSync(projectPath);
      } catch (error: unknown) {
        console.warn(`[uninstall] Could not read ${projectPath}:`, error instanceof Error ? error.message : String(error));
        continue;
      }
      for (const entry of logEntries) {
        if (!entry.startsWith('mcp-logs-plugin-claude-mem-')) continue;
        const logPath = join(projectPath, entry);
        try {
          rmSync(logPath, { recursive: true, force: true });
          removedCount++;
        } catch (error: unknown) {
          console.warn(`[uninstall] Could not remove ${logPath}:`, error instanceof Error ? error.message : String(error));
        }
      }
    }
  }

  const pluginDataDir = join(home, '.claude', 'plugins', 'data', 'claude-mem-thedotmack');
  if (existsSync(pluginDataDir)) {
    try {

View on GitHub (pinned to e2d1df569a)

Solutions

  1. Check the path in the message: ls -ld <projectPath>
  2. Fix ownership and permissions, or remove the directory: rm -rf <projectPath>, then re-run uninstall
  3. Ignore it if stale MCP logs for that one project do not matter
Defensive patterns

Strategy: validation

Validate before calling

import { statSync, accessSync, constants } from 'node:fs';
// Skip entries that are not readable directories before handing them to a sweep
const st = statSync(projectPath);
if (st.isDirectory()) accessSync(projectPath, constants.R_OK);

Type guard

function isErrnoException(error: unknown): error is NodeJS.ErrnoException {
  return error instanceof Error && typeof (error as NodeJS.ErrnoException).code === 'string';
}

Prevention

When it happens

Trigger: `npx claude-mem uninstall` when an individual project cache directory has restrictive permissions, was deleted between listing and reading, or is not actually a directory (a stray file where a dir was expected).

Common situations: Per-project directories created under different credentials; cleanup tools (bleachbit, CCleaner) deleting cache contents while uninstall runs.

Related errors


AI-assisted analysis of thedotmack/claude-mem@e2d1df569a (2026-08-20). Data as JSON: /api/errors/f8d3e894156ce066. Report an issue: GitHub.