{"record":{"id":"42e896e2083c05d0","repo":"rohitg00/agentmemory","slug":"claude-code-hooks-fallback-skipped-hookresult-r","errorCode":null,"errorMessage":"Claude Code hooks fallback skipped: ${hookResult.reason}.","messagePattern":"Claude Code hooks fallback skipped: (.+?)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cli/connect/claude-code.ts","lineNumber":67,"sourceCode":"  },\n\n  async install(opts: ConnectOptions): Promise<ConnectResult> {\n    const existing = readJsonSafe<ClaudeConfig>(CLAUDE_JSON);\n    const next: ClaudeConfig = existing ? { ...existing } : {};\n    const servers: Record<string, ClaudeMcpEntry> = {\n      ...((next.mcpServers as Record<string, ClaudeMcpEntry>) ?? {}),\n    };\n\n    const alreadyHas = entryMatches(servers[\"agentmemory\"]);\n    if (alreadyHas && !opts.force) {\n      logAlreadyWired(\"Claude Code\", CLAUDE_JSON);\n      // --with-hooks is independent of MCP wiring (issue #508). Run the\n      // hooks fallback even when MCP is already in place so users with a\n      // healthy MCP setup can still pick up version-stable hook paths.\n      if (opts.withHooks) {\n        const hookResult = installClaudeHooks(opts);\n        if (hookResult.kind === \"skipped\") {\n          p.log.warn(\n            `Claude Code hooks fallback skipped: ${hookResult.reason}.`,\n          );\n        }\n      }\n      return { kind: \"already-wired\", mutatedPath: CLAUDE_JSON };\n    }\n\n    if (opts.dryRun) {\n      p.log.info(\n        `[dry-run] Would ${alreadyHas ? \"overwrite\" : \"add\"} mcpServers.agentmemory in ${CLAUDE_JSON}`,\n      );\n      return { kind: \"installed\", mutatedPath: CLAUDE_JSON };\n    }\n\n    let backupPath: string | undefined;\n    if (existsSync(CLAUDE_JSON)) {\n      backupPath = backupFile(CLAUDE_JSON, \"claude-code\");\n      logBackup(backupPath);","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/rohitg00/agentmemory/blob/e04ba88819c365c9acf9d6661ea802143e728bd6/src/cli/connect/claude-code.ts#L49-L85","documentation":"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.","triggerScenarios":"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.","commonSituations":"Re-running install over an existing setup; hooks previously installed by another version; read-only ~/.claude/settings.json; Claude Code not fully installed.","solutions":["Read the reported reason in the warning and address it (e.g. conflicting settings.json entries)","Remove/rename stale hook entries in ~/.claude/settings.json and re-run install with --with-hooks","Skip the hooks fallback if MCP is healthy and hooks are not needed — this is non-fatal"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const res = installClaudeHooks(opts);\nif (res.kind === \"skipped\") console.warn(`hooks not installed: ${res.reason}`);","typeGuard":"function isSkipped(r: {kind: string; reason?: string}): r is {kind: \"skipped\"; reason: string} { return r.kind === \"skipped\"; }","tryCatchPattern":null,"preventionTips":["Review ~/.claude/settings.json for pre-existing hook entries before installing","Keep hook paths in sync when upgrading agentmemory versions","Treat hook-skip warnings as non-fatal; verify MCP health separately"],"tags":["claude-code","hooks","installer"],"backgroundTag":"hook-install-skipped","analyzedSha":"e04ba88819c365c9acf9d6661ea802143e728bd6","analyzedAt":"2026-08-30T01:07:40.754Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}