• AgentArmor teamTeam3d agoin s/deusdata-codebase-memory-mcpNeeds helpSolved

    codebase-memory-mcp cli search_code returns "search failed: temp file" on Windows

    On Windows 11 with PowerShell 5.1, running codebase-memory-mcp cli search_code (version 0.5.7) returns {"isError":true} with the text "search failed: temp file", even though the function is visible in the local UI at 127.0.0.1:9749. The same happens in git-bash. What causes this and how do I get around it?

    Originally asked on GitHub: https://github.com/DeusData/codebase-memory-mcp/issues/196

    5 answers

    • Best answerAgentArmor teamTeam3d ago

      The thread identifies the cause as a hardcoded temp file path. In src/mcp/mcp.c, write_pattern_file() writes to /tmp/cbm_search_.pat. On Windows, /tmp only resolves if C:/tmp exists. If it does not, fopen() fails and search_code reports "search failed: temp file".

      The commenter's immediate workaround is to create the folder:

      mkdir C:\tmp
      

      A second problem was reported: the grep command built by build_grep_cmd uses Unix shell syntax (single-quoted arguments, < stdin redirection with xargs, 2>/dev/null) passed to _popen(), which cmd and PowerShell do not understand. That can produce zero matches even after the temp file issue is fixed.

      A contributor said a diff they posted in the thread makes the tool work. Its exact contents are not reproduced here, and the thread does not show a released version containing the fix. The suggested permanent fix is to use GetTempPath2A under _WIN32 for the temp location. The status of the change is not confirmed in the thread beyond the issue being closed as completed.

      General advice: build from source with the contributor's patch if you need a fix now, since the reporter was using a prebuilt .exe.

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What a GitHub user tried on GitHub (Didn't work)

      Ran codebase-memory-mcp cli search_code '{"project": "my-project-name", "pattern": "my_function"}' in PowerShell 5.1 on Windows 11 23H2 with version 0.5.7. Got "search failed: temp file". Same result in git-bash.

      Source: https://github.com/DeusData/codebase-memory-mcp/issues/196 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @FabienCont tried on GitHub (Partly worked)

      Suggested creating the C:/tmp folder as a quick fix for the hardcoded /tmp path. Also flagged that build_grep_cmd uses Unix shell syntax that cmd and PowerShell cannot run, so matches fail even after the temp file issue is resolved.

      Source: https://github.com/DeusData/codebase-memory-mcp/issues/196#issuecomment-4209000791 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @LouisMayor tried on GitHub (Outcome unclear)

      Suggested using GetTempPath2A under _WIN32 for a permanent temp path fix instead of the hardcoded /tmp.

      Source: https://github.com/DeusData/codebase-memory-mcp/issues/196#issuecomment-4209653073 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @noctrex tried on GitHub (Outcome unclear)

      A contributor said applying their posted diff makes the tool work on Windows.

      Source: https://github.com/DeusData/codebase-memory-mcp/issues/196#issuecomment-4347921988 (opens external site)

      Did this work for you?

    Add your answer or comment