thedotmack/claude-mem · warning
[uninstall] Could not read ${filePath}:
Error message
[uninstall] Could not read ${filePath}: What it means
Uninstall scans shell rc files (~/.bashrc, ~/.zshrc, and the PowerShell profile) for legacy `alias claude-mem =` lines. If readFileSync fails on one candidate file, it warns and skips to the next file, so that file keeps its claude-mem alias after uninstall.
Source
Thrown at src/npx-cli/commands/uninstall.ts:117
}
function stripLegacyClaudeMemAlias(): void {
const home = homedir();
const candidateFiles = [
join(home, '.bashrc'),
join(home, '.zshrc'),
join(home, 'Documents', 'PowerShell', 'Microsoft.PowerShell_profile.ps1'),
];
const aliasLineRegex = /^\s*alias\s+claude-mem\s*=/;
for (const filePath of candidateFiles) {
if (!existsSync(filePath)) continue;
let content: string;
try {
content = readFileSync(filePath, 'utf-8');
} catch (error: unknown) {
console.warn(`[uninstall] Could not read ${filePath}:`, error instanceof Error ? error.message : String(error));
continue;
}
const lines = content.split('\n');
const filtered = lines.filter((line) => !aliasLineRegex.test(line));
if (filtered.length === lines.length) continue;
try {
writeFileSync(filePath, filtered.join('\n'));
console.error(`Removed legacy claude-mem alias from ${filePath}`);
} catch (error: unknown) {
console.warn(`[uninstall] Could not rewrite ${filePath}:`, error instanceof Error ? error.message : String(error));
}
}
}
export function removeFromClaudeSettings(): void {
const settings = readJsonSafe<Record<string, any>>(claudeSettingsPath(), {});
let dirty = false;
View on GitHub (pinned to e2d1df569a)
Solutions
- Check the file named in the message: ls -l <filePath>
- Fix it: sudo chown $(whoami) <filePath> && chmod u+rw <filePath>
- Re-run `npx claude-mem uninstall`, or delete the `alias claude-mem =` line yourself
Defensive patterns
Strategy: validation
Validate before calling
import { accessSync, constants } from 'node:fs';
for (const rc of [`${process.env.HOME}/.bashrc`, `${process.env.HOME}/.zshrc`]) {
try { accessSync(rc, constants.R_OK); }
catch { /* fix perms before uninstall or the alias removal will skip this file */ }
} Type guard
function isErrnoException(error: unknown): error is NodeJS.ErrnoException {
return error instanceof Error && typeof (error as NodeJS.ErrnoException).code === 'string';
} Prevention
- Keep shell rc files owned and readable by your user
- Never edit dotfiles with sudo
- After uninstall, grep rc files for 'claude-mem' to confirm the alias removal ran
When it happens
Trigger: `npx claude-mem uninstall` when an rc file exists but cannot be read: root-owned after a sudo edit, mode 000 or owned by another user, a dangling symlink, or an I/O error from a failing disk.
Common situations: Dotfiles managed by root or another account; rc files symlinked into a private dotfiles repo with restrictive permissions; managed corporate machines.
Related errors
- [uninstall] Could not rewrite ${filePath}:
- [uninstall] Could not write settings during server runtime c
- [uninstall] Could not read ${npxRoot}:
- [uninstall] Could not read ${cacheRoot}:
- [uninstall] Could not read ${projectPath}:
AI-assisted analysis of thedotmack/claude-mem@e2d1df569a (2026-08-20).
Data as JSON: /api/errors/9b50f6275d0d554e.
Report an issue: GitHub.