rohitg00/agentmemory · warning

Claude Code hooks fallback skipped: ${hookResult.reason}.

Error message

Claude Code hooks fallback skipped: ${hookResult.reason}.

What it means

Warning during `connect claude-code --with-hooks` (or install with hooks enabled) when MCP wiring is already present (already-wired path) but the hooks fallback installer returned a "skipped" result; the reason is surfaced verbatim. MCP remains functional; only hook installation was not performed.

Source

Thrown at src/cli/connect/claude-code.ts:67

  },

  async install(opts: ConnectOptions): Promise<ConnectResult> {
    const existing = readJsonSafe<ClaudeConfig>(CLAUDE_JSON);
    const next: ClaudeConfig = existing ? { ...existing } : {};
    const servers: Record<string, ClaudeMcpEntry> = {
      ...((next.mcpServers as Record<string, ClaudeMcpEntry>) ?? {}),
    };

    const alreadyHas = entryMatches(servers["agentmemory"]);
    if (alreadyHas && !opts.force) {
      logAlreadyWired("Claude Code", CLAUDE_JSON);
      // --with-hooks is independent of MCP wiring (issue #508). Run the
      // hooks fallback even when MCP is already in place so users with a
      // healthy MCP setup can still pick up version-stable hook paths.
      if (opts.withHooks) {
        const hookResult = installClaudeHooks(opts);
        if (hookResult.kind === "skipped") {
          p.log.warn(
            `Claude Code hooks fallback skipped: ${hookResult.reason}.`,
          );
        }
      }
      return { kind: "already-wired", mutatedPath: CLAUDE_JSON };
    }

    if (opts.dryRun) {
      p.log.info(
        `[dry-run] Would ${alreadyHas ? "overwrite" : "add"} mcpServers.agentmemory in ${CLAUDE_JSON}`,
      );
      return { kind: "installed", mutatedPath: CLAUDE_JSON };
    }

    let backupPath: string | undefined;
    if (existsSync(CLAUDE_JSON)) {
      backupPath = backupFile(CLAUDE_JSON, "claude-code");
      logBackup(backupPath);

View on GitHub (pinned to e04ba88819)

Solutions

  1. Read the reported reason in the warning and address it (e.g. conflicting settings.json entries)
  2. Remove/rename stale hook entries in ~/.claude/settings.json and re-run install with --with-hooks
  3. Skip the hooks fallback if MCP is healthy and hooks are not needed — this is non-fatal
Defensive patterns

Strategy: fallback

Validate before calling

const res = installClaudeHooks(opts);
if (res.kind === "skipped") console.warn(`hooks not installed: ${res.reason}`);

Type guard

function isSkipped(r: {kind: string; reason?: string}): r is {kind: "skipped"; reason: string} { return r.kind === "skipped"; }

Prevention

When it happens

Trigger: install() detects CLAUDE_JSON already wired to agentmemory MCP and opts.withHooks is true, but installClaudeHooks(opts) returns { kind: "skipped", reason } — e.g. hooks already installed with different paths, unsupported platform, or settings file conflicts.

Common situations: Re-running install over an existing setup; hooks previously installed by another version; read-only ~/.claude/settings.json; Claude Code not fully installed.

Related errors


AI-assisted analysis of rohitg00/agentmemory@e04ba88819 (2026-08-30). Data as JSON: /api/errors/42e896e2083c05d0. Report an issue: GitHub.