thedotmack/claude-mem · warning
Could not restrict permissions on
Error message
Could not restrict permissions on ${path} to 0600: ${chmodError instanceof Error ? chmodError.message : String(chmodError)} What it means
After writing settings.json (which may contain API keys), the installer chmods the file to 0600 so it is owner-only readable. If chmod fails, it warns with the OS error but does NOT fail the settings write itself — the file exists with looser (typically 0644) permissions.
Solutions
- Manually restrict the file: `chmod 600 <path>` (or equivalent ACL on Windows) and verify with `ls -l`.
- Move the settings file to a filesystem supporting POSIX permissions and rerun.
- Run the installer as the user who owns the file (or fix ownership with `chown`).
Example fix
// before (loose permissions) -rw-r--r-- settings.json // after chmod 600 ~/.claude/settings.json
Defensive patterns
Strategy: validation
Validate before calling
import { statSync } from 'fs';
const st = statSync(settingsPath);
if ((st.mode & 0o077) !== 0) {
console.warn(`${settingsPath} is group/world readable; run: chmod 600 ${settingsPath}`);
} Try / catch
try {
chmodSync(path, 0o600);
} catch (chmodError) {
console.warn(`Could not restrict permissions on ${path} to 0600: ${chmodError.message}`);
// fix manually; do not fail the settings write
} Prevention
- Keep settings files on filesystems supporting POSIX permissions (ext4/APFS, not FAT/exFAT shares).
- Run the installer as the same user who owns the settings file.
- After install, verify with `ls -l` that secrets-bearing files are 0600.
When it happens
Trigger: `chmodSync(path, 0o600)` throws — the file is on a filesystem that doesn't support POSIX permissions (FAT/exFAT/NTFS mounts, some network shares), or the process lacks ownership/permission on the file.
Common situations: Running the installer against settings on a Windows-mounted or WSL-interop drive; running as a different user than the file owner; container with restrictive volume mount options.
Understand the failure class
Background: "Permission denied" / "Failed to write" file errors: why a library can't write its files to disk (EACCES, EPERM, ENOSPC) and how to fix them — this error's family across 43 libraries.
Related errors
- Access denied: " " resolves outside the workspace ( ). MCP…
- Admin endpoints are only accessible from localhost
- claude-mem: could not read
- Corrupt hooks.json at
- DENY_ALLOW
AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17).
Data as JSON: /api/errors/cba7bf37f17269b6.
Report an issue: GitHub.
Appendix: source
Thrown at src/npx-cli/commands/install.ts:879
}
}
const target = envNested
? (document.env as Record<string, unknown>)
: document;
for (const [key, value] of Object.entries(updates)) {
target[key] = value;
}
writeSettingsJsonAtomic(path, document);
// settings.json can carry tokens (CMEM Pro setup token, provider API
// keys); a fresh file inherits the umask (usually 0644), leaving them
// world-readable. Tighten to owner-only. Fail-soft: a chmod failure must
// never fail the settings write itself, but it is not silent.
try {
chmodSync(path, 0o600);
} catch (chmodError: unknown) {
log.warn(`Could not restrict permissions on ${path} to 0600: ${chmodError instanceof Error ? chmodError.message : String(chmodError)}`);
}
return true;
} catch (error: unknown) {
log.error(`Failed to write settings to ${path}: ${error instanceof Error ? error.message : String(error)}`);
return false;
}
}
type ProviderId = 'claude' | 'gemini' | 'openrouter' | 'host';
/**
* What the installer prompt may offer. `cmem` is a prompt-only sentinel: picking
* it configures the generic OpenAI-compatible path (base URL + model + key) and
* persists CLAUDE_MEM_PROVIDER='openrouter'. The worker only understands
* 'claude' | 'gemini' | 'openrouter', so 'cmem' must never reach settings.json.
*/
type ProviderChoice = ProviderId | 'cmem';
// Phase 1d: Persisted DB literals (`server_beta_schema_migrations`, job_type
// enums, `server-beta-worker` lockedBy marker) are intentionally preserved inView on GitHub (pinned to d8bc9755e7)