thedotmack/claude-mem · warning
[uninstall] Could not write settings during server runtime c
Error message
[uninstall] Could not write settings during server runtime cleanup:
What it means
After deleting server-runtime keys from the flat settings map, clearServerRuntimeSettings() persists the map with writeSettingsJsonAtomic(USER_SETTINGS_PATH, flat). If that atomic write throws (EACCES/EPERM, ENOSPC, a Windows file lock, or a rename failure), the warning prints and the key deletions are effectively lost: stale CLAUDE_MEM_* server keys remain in settings.json while uninstall continues.
Source
Thrown at src/npx-cli/commands/uninstall.ts:62
try {
flat = readFlatSettings(USER_SETTINGS_PATH);
} catch (error: unknown) {
console.warn('[uninstall] Could not read settings for server runtime cleanup:', error instanceof Error ? error.message : String(error));
return;
}
if (!flat) return;
let changed = false;
for (const key of keys) {
if (key in flat) {
delete flat[key];
changed = true;
}
}
if (changed) {
try {
writeSettingsJsonAtomic(USER_SETTINGS_PATH, flat);
} catch (error: unknown) {
console.warn('[uninstall] Could not write settings during server runtime cleanup:', error instanceof Error ? error.message : String(error));
}
}
}
function removeMarketplaceDirectory(): boolean {
const marketplaceDir = marketplaceDirectory();
if (existsSync(marketplaceDir)) {
rmSync(marketplaceDir, { recursive: true, force: true });
return true;
}
return false;
}
function removeCacheDirectory(): boolean {
const cacheDirectory = join(pluginsDirectory(), 'cache', 'thedotmack', 'claude-mem');
if (existsSync(cacheDirectory)) {
rmSync(cacheDirectory, { recursive: true, force: true });
return true;View on GitHub (pinned to e2d1df569a)
Solutions
- Close Claude Desktop/Code and any editor holding ~/.claude/settings.json, then re-run `npx claude-mem uninstall`
- Fix ownership and permissions: sudo chown $(whoami) ~/.claude/settings.json && chmod u+w ~/.claude/settings.json
- Free disk space if the write failed with ENOSPC
- If the write keeps failing, delete the CLAUDE_MEM_* keys from settings.json manually
Defensive patterns
Strategy: validation
Validate before calling
import { accessSync, constants } from 'node:fs';
const settings = `${process.env.HOME}/.claude/settings.json`;
try {
accessSync(settings, constants.W_OK); // predict the atomic-write failure before uninstall
} catch {
// fix ownership/permissions or close the app holding the file
} Type guard
function isErrnoException(error: unknown): error is NodeJS.ErrnoException {
return error instanceof Error && typeof (error as NodeJS.ErrnoException).code === 'string';
} Prevention
- Close Claude apps and editors before uninstalling so settings.json is unlocked
- Keep settings.json user-owned and writable (chmod u+w)
- Watch free disk space: ENOSPC turns the atomic write into a silent no-op for cleanup
When it happens
Trigger: Uninstall reaches server-runtime cleanup while settings.json is read-only or owned by another user, the disk is full, or Claude Desktop / an editor / antivirus holds the file with an exclusive lock on Windows.
Common situations: Running Claude Code while uninstalling; Windows indexer or antivirus locking settings.json; ENOSPC on a full home partition; two uninstalls racing on the same file.
Related errors
- [uninstall] Could not read selected runtime from settings, d
- [uninstall] Could not read settings for server runtime clean
- [uninstall] Could not read ${filePath}:
- [uninstall] Could not read ${npxRoot}:
- [uninstall] Could not read ${cacheRoot}:
AI-assisted analysis of thedotmack/claude-mem@e2d1df569a (2026-08-20).
Data as JSON: /api/errors/20be550ed7eb03bd.
Report an issue: GitHub.