Skip to content

codebase-memory-mcp dev (built from source via NixOS flake, github:DeusData/codebase-memory-mcp) #460

@kortschak

Description

@kortschak

Version

e599df1

Platform

Linux (x64)

Install channel

Built from source

Binary variant

standard

What happened, and what did you expect?

After codebase-memory-mcp install on NixOS, every Claude Code session start showed:

SessionStart:resume [~/.claude/hooks/cbm-session-reminder] failed with non-blocking
status code 127: /bin/sh: line 1: /home/<user>/.claude/hooks/cbm-session-reminder: cannot
execute: required file not found

The hooks installed by codebase-memory-mcp install have #!/bin/bash shebangs. On NixOS, /bin/bash does not exist — only /bin/sh (which is bash, but only via a NixOS-managed symlink). When Claude Code executes the hook, /usr/bin/env searches a stripped PATH that does not include the directory containing bash, so env bash also fails. The fix is to use the absolute path to bash: #!/run/current-system/sw/bin/bash.

Expected: the hooks install with a portable shebang (e.g. #!/usr/bin/env bash) and Claude Code runs hooks with a PATH that includes standard binary locations, or the install script detects the system bash path and uses it directly.

Reproduction

  1. Install NixOS (any recent release). /bin/bash does not exist; bash lives at /run/current-system/sw/bin/bash.
  2. Install codebase-memory-mcp from the flake (see details) and run codebase-memory-mcp install targeting Claude Code.
  3. Start a new Claude Code session.
  4. Observe the status code 127 error for cbm-session-reminder and cbm-code-discovery-gate.

Workaround applied: replace #!/bin/bash with #!/run/current-system/sw/bin/bash in both hook files.

A more portable fix would be for the install script to detect the system bash path (e.g. $(command -v bash)) and write that into the shebang, or to ensure Claude Code's hook runner provides a PATH that includes standard binary directories.

Details

flake.lock

{
  "nodes": {
    "codebase-memory-mcp": {
       "inputs": {
         "nixpkgs": [
           "nixpkgs"
         ]
       },
       "locked": {
         "lastModified": 1781281003,
         "narHash": "sha256-jFIZ3+EgNUK3z/6dg0U4idxmp0UHa8Zk79Z36dhE3hg=",
         "owner": "DeusData",
         "repo": "codebase-memory-mcp",
         "rev": "e599df1d563c1e9b0b2fc8c6b12ee85934ade1c5",
         "type": "github"
       },
       "original": {
         "owner": "DeusData",
         "repo": "codebase-memory-mcp",
         "type": "github"
       }
     },
     <more>

flake.nix

   <more>
   codebase-memory-mcp = {
     url = "github:DeusData/codebase-memory-mcp";
     inputs.nixpkgs.follows = "nixpkgs";
   };
   <more>

Logs

/bin/sh: line 1: /home/<user>/.claude/hooks/cbm-session-reminder: cannot execute: required file not found

strace output showing env searching a PATH without any directory containing bash:

execve("/nix/store/.../zplug-2.4.2/share/zplug/bin/bash", ...) = -1 ENOENT
execve("/home/<user>/bin/bash", ...) = -1 ENOENT
execve("/home/<user>/.local/bin/bash", ...) = -1 ENOENT
execve("/run/wrappers/bin/bash", ...) = -1 ENOENT
execve("/home/<user>/.nix-profile/bin/bash", ...) = -1 ENOENT

Project scale (if relevant)

53 nodes / 52 edges (small NixOS config repo)

Confirmations

  • I searched existing issues and this is not a duplicate.
  • My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions