thedotmack/claude-mem · warning

[uninstall] Could not remove ${logPath}:

Error message

[uninstall] Could not remove ${logPath}:

What it means

For each mcp-logs-plugin-claude-mem-* entry found in a project cache directory, uninstall runs rmSync(recursive, force) on it. If the removal throws (EACCES/EPERM, EBUSY on Windows), it warns and continues; removedCount is not incremented for that entry.

Source

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

      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 {
      rmSync(pluginDataDir, { recursive: true, force: true });
      removedCount++;
    } catch (error: unknown) {
      console.warn(`[uninstall] Could not remove ${pluginDataDir}:`, error instanceof Error ? error.message : String(error));
    }
  }

  return removedCount;
}

View on GitHub (pinned to e2d1df569a)

Solutions

  1. Close Claude CLI sessions and stop MCP servers, then re-run uninstall
  2. Delete the path from the message manually: rm -rf <logPath>
  3. Fix ownership under ~/.cache/claude-cli-nodejs if needed
Defensive patterns

Strategy: validation

Validate before calling

import { accessSync, constants } from 'node:fs';
const logDir = `${process.env.HOME}/.cache/claude-cli-nodejs/<project>/mcp-logs-plugin-claude-mem-<id>`;
try { accessSync(logDir, constants.W_OK); }
catch { /* close the Claude/MCP process holding it, then retry uninstall */ }

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` while the Claude CLI or an MCP server child process still holds the log directory or its files open; log files owned by another user; Windows locks on the log files.

Common situations: Uninstalling with a Claude session still running; MCP servers keeping log handles open; log directories written by a root-run process.

Related errors


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