thedotmack/claude-mem · info
[ide-detection] Failed to read VS Code extensions directory:
Error message
[ide-detection] Failed to read VS Code extensions directory:
What it means
A console.warn from the installer's IDE detection: readdirSync on ~/.vscode/extensions threw (typically EACCES/EPERM) after the directory was confirmed to exist. The function returns false for that check, so VS Code / VS Code-based IDEs are reported as not detected and the installer's pre-selection lists fewer IDEs. Detection of command-line IDEs is unaffected.
Source
Thrown at src/npx-cli/commands/ide-detection.ts:40
execFileSync('which', [command], { stdio: 'ignore' });
}
return true;
} catch (error: unknown) {
if (process.env.DEBUG) {
console.error(`[ide-detection] ${command} not in PATH:`, error instanceof Error ? error.message : String(error));
}
return false;
}
}
function hasVscodeExtension(extensionNameFragment: string): boolean {
const extensionsDirectory = join(homedir(), '.vscode', 'extensions');
if (!existsSync(extensionsDirectory)) return false;
try {
const entries = readdirSync(extensionsDirectory);
return entries.some((entry) => entry.toLowerCase().includes(extensionNameFragment.toLowerCase()));
} catch (error: unknown) {
console.warn('[ide-detection] Failed to read VS Code extensions directory:', error instanceof Error ? error.message : String(error));
return false;
}
}
export function detectInstalledIDEs(): IDEInfo[] {
const home = homedir();
return [
{
id: 'claude-code',
label: 'Claude Code',
detected: isCommandInPath('claude'),
hint: 'recommended',
},
{
id: 'opencode',
label: 'OpenCode',
detected:View on GitHub (pinned to e2d1df569a)
Solutions
- Fix ownership/permissions: sudo chown -R $USER ~/.vscode && chmod -R u+rX ~/.vscode
- Then simply select the IDE manually on the installer prompt — detection failing only affects auto-selection
- Check with ls ~/.vscode/extensions in the same shell to confirm the read now succeeds
Example fix
# before $ ls ~/.vscode/extensions ls: cannot open directory: Permission denied # after $ sudo chown -R $USER ~/.vscode && chmod -R u+rX ~/.vscode $ npx claude-mem install # VS Code now auto-detected
Defensive patterns
Strategy: fallback
Validate before calling
import { accessSync, constants } from 'node:fs';
function extensionsReadable(dir: string): boolean {
try { accessSync(dir, constants.R_OK); return true; } catch { return false; }
} Prevention
- Keep ~/.vscode owned and readable by your user (never edit dotfiles with sudo)
- When detection fails, select IDEs manually in the installer prompt instead of trusting auto-detect
- Run installers as the regular user, not root
When it happens
Trigger: Running `npx claude-mem install` where ~/.vscode/extensions exists but is unreadable — restrictive home-dir permissions, root-owned directory from a past sudo run, or SELinux/AppArmor denying reads.
Common situations: Running the installer under sudo so later runs as the normal user lack read access; managed/locked-down corporate machines; NAS-mounted home directories with odd ACL semantics.
Related errors
- Could not read ${configFile}: ${error instanceof Error ? err
- Could not update ${configFile}: ${error instanceof Error ? e
- installPluginDependencies: no package.json at ${targetDir}
- Corrupt JSON in ${GEMINI_SETTINGS_PATH}, refusing to overwri
- MCP server script not found
AI-assisted analysis of thedotmack/claude-mem@e2d1df569a (2026-08-20).
Data as JSON: /api/errors/60ba046820cd353c.
Report an issue: GitHub.