thedotmack/claude-mem · warning

claude-mem: could not read ${USER_SETTINGS_PATH} while check

Error message

claude-mem: could not read ${USER_SETTINGS_PATH} while checking vector-search opt-out:

What it means

During install's runtime setup, userHasOptedOutOfVectorSearch() reads ~/.claude/settings.json directly (BOM-tolerant parse) looking for CLAUDE_MEM_DISABLE_VECTOR_SEARCH at the top level or under env. If the read or parse throws, it warns and returns false: you are treated as NOT opted out, so the installer provisions the vector-search stack (Chroma/uv) you explicitly disabled.

Source

Thrown at src/npx-cli/install/setup-runtime.ts:44

    : 'Install Bun manually: `curl -fsSL https://bun.sh/install | bash` (or `brew install oven-sh/bun/bun`), then re-run `npx claude-mem install`.';
}

export function platformUvRemediation(): string {
  return IS_WINDOWS
    ? 'Install uv manually: `winget install astral-sh.uv` (or `powershell -c "irm https://astral.sh/uv/install.ps1 | iex"`), then re-run `npx claude-mem install`.'
    : 'Install uv manually: `curl -LsSf https://astral.sh/uv/install.sh | sh` (or `brew install uv`), then re-run `npx claude-mem install`.';
}

function userHasOptedOutOfVectorSearch(): boolean {
  // Read the settings file directly (the value is not in the typed defaults).
  // Honors both a top-level key and an `env`-nested key.
  let raw: unknown;
  try {
    if (!existsSync(USER_SETTINGS_PATH)) return false;
    raw = parseJsonWithBom(readFileSync(USER_SETTINGS_PATH, 'utf-8'));
  } catch (error) {
    const err = error instanceof Error ? error : new Error(String(error));
    console.warn(`claude-mem: could not read ${USER_SETTINGS_PATH} while checking vector-search opt-out:`, err);
    return false;
  }
  if (!raw || typeof raw !== 'object') return false;
  const record = raw as Record<string, unknown>;
  const envBlock = (record.env && typeof record.env === 'object')
    ? (record.env as Record<string, unknown>)
    : {};
  const value = record.CLAUDE_MEM_DISABLE_VECTOR_SEARCH ?? envBlock.CLAUDE_MEM_DISABLE_VECTOR_SEARCH;
  return value === true || value === 'true' || value === '1';
}

const BUN_COMMON_PATHS = IS_WINDOWS
  ? [join(homedir(), '.bun', 'bin', 'bun.exe')]
  : [join(homedir(), '.bun', 'bin', 'bun'), '/usr/local/bin/bun', '/opt/homebrew/bin/bun', '/home/linuxbrew/.linuxbrew/bin/bun'];

const UV_COMMON_PATHS = IS_WINDOWS
  ? [join(homedir(), '.local', 'bin', 'uv.exe'), join(homedir(), '.cargo', 'bin', 'uv.exe')]
  : [join(homedir(), '.local', 'bin', 'uv'), join(homedir(), '.cargo', 'bin', 'uv'), '/usr/local/bin/uv', '/opt/homebrew/bin/uv'];

View on GitHub (pinned to e2d1df569a)

Solutions

  1. Repair settings.json until a plain JSON.parse succeeds, then re-run `npx claude-mem install`
  2. Alternatively export CLAUDE_MEM_DISABLE_VECTOR_SEARCH=true in your shell so the opt-out does not depend on the settings file
  3. If the vector stack was already installed against your intent, run `npx claude-mem uninstall` (it preserves ~/.claude-mem data) and reinstall after fixing settings
Defensive patterns

Strategy: validation

Validate before calling

import { readFileSync } from 'node:fs';
// Before install: settings.json must parse or your vector-search opt-out is ignored
const settings = `${process.env.HOME}/.claude/settings.json`;
JSON.parse(readFileSync(settings, 'utf8'));

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 install` with a malformed or unreadable ~/.claude/settings.json (truncated, trailing comma, wrong ownership) while CLAUDE_MEM_DISABLE_VECTOR_SEARCH=true was set to skip vector search.

Common situations: Hand-edited settings with invalid JSON; settings.json corrupted by another tool; the opt-out flag set but the file unreadable so the opt-out is silently ignored and uv/Chroma get installed.

Related errors


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