thedotmack/claude-mem · info

Skipping local hook API key bootstrap: CLAUDE_MEM_SERVER_DAT

Error message

Skipping local hook API key bootstrap: CLAUDE_MEM_SERVER_DATABASE_URL is not set. Run `npx claude-mem server keys rotate` after configuring Postgres to provision a key.

What it means

At the end of install, the installer wants to provision a local hook API key by inserting into the server's api_keys table, but that requires Postgres access via CLAUDE_MEM_SERVER_DATABASE_URL. When the env var is unset it skips the bootstrap with this warning and tells you the exact remediation command; hooks keep working by falling back to the worker.

Source

Thrown at src/npx-cli/commands/install.ts:952

      + `(pg + redis/valkey). The server listens at ${serverBaseUrl}.`,
  );

  // The server mounts its MCP endpoint at `<baseUrl>/mcp` over HTTP (vs. the
  // worker's stdio transport); trailing slashes are trimmed so we never emit
  // `http://host//mcp`.
  log.info(
    `IDE MCP config target for the server runtime: http ${serverBaseUrl.replace(/\/+$/, '')}/mcp`,
  );

  await maybeBootstrapServerApiKey();
}

async function maybeBootstrapServerApiKey(): Promise<void> {
  // Only attempt if Postgres is configured. Without DATABASE_URL we cannot
  // reach the api_keys table — the operator must configure the server first
  // and rerun `claude-mem server keys rotate`.
  if (!process.env.CLAUDE_MEM_SERVER_DATABASE_URL) {
    log.warn(
      'Skipping local hook API key bootstrap: CLAUDE_MEM_SERVER_DATABASE_URL is not set. '
        + 'Run `npx claude-mem server keys rotate` after configuring Postgres to provision a key.',
    );
    return;
  }
  try {
    await bootstrapAndPersistServerApiKey();
  } catch (error: unknown) {
    // [ANTI-PATTERN IGNORED]: the failure is already surfaced to the user via the interactive-aware log.warn wrapper below (p.log.warn in a TTY, console.warn otherwise), including the manual remediation command.
    log.warn(
      `Failed to bootstrap server API key: ${error instanceof Error ? error.message : String(error)}. `
        + 'Hooks will fall back to the worker until you run `npx claude-mem server keys rotate`.',
    );
  }
}

async function bootstrapAndPersistServerApiKey(): Promise<void> {
  const { bootstrapServerApiKey, persistServerSettings } = await import(

View on GitHub (pinned to e2d1df569a)

Solutions

  1. If you do not run the claude-mem server: ignore it — hooks use the worker fallback by design.
  2. If you do: export CLAUDE_MEM_SERVER_DATABASE_URL (or put it where install runs), rerun `npx claude-mem install`.
  3. Provision the key manually afterwards: `npx claude-mem server keys rotate`.

Example fix

# before: install without server env
npx claude-mem install  # warns: bootstrap skipped
# after
export CLAUDE_MEM_SERVER_DATABASE_URL=postgres://...
npx claude-mem install && npx claude-mem server keys rotate
Defensive patterns

Strategy: validation

Validate before calling

// Decide up front whether server-mode bootstrap applies:
const serverMode = Boolean(process.env.CLAUDE_MEM_SERVER_DATABASE_URL);
if (!serverMode) {
  // expect the skip warning; plan to run `npx claude-mem server keys rotate` later
}

Prevention

When it happens

Trigger: Running `npx claude-mem install` on a machine that does NOT run the claude-mem server component (no CLAUDE_MEM_SERVER_DATABASE_URL exported), or a server deployment where the env var is set only in the service unit, not the interactive shell running install.

Common situations: Typical client-only installs — this warning is expected and harmless; forgetting to export the server env in the shell used for install; Postgres configured later, after claude-mem was already installed.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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