Save to project memory fails with "Must use correct memory file path" error

Resolved 💬 21 comments Opened Jun 23, 2025 by vondra Closed Aug 15, 2025

Bug Description

When attempting to use the \"Save to project memory\" feature in Claude Code, the operation fails with a file path validation error.

Steps to Reproduce

  1. Run Claude Code in interactive mode
  2. Try to save information to project memory (with #)
  3. The operation fails with the following error

Full Error Output

Saving project memory…

file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1976
\`\`\``}),Y=await Ze1([D],[aU2(I)],0,Z,B.abortController.signal,{getToolPermissionContext:B.getToolPermissionContext,model:J_(),prependCLISysprompt:\!0,toolChoice:{name:sJ.name,type:"tool"},isNonInteractiveSession:B.options.isNonInteractiveSession}),W=Y.message.content.find((V)=>V.type==="tool_use");if(\!W){b1(new Error("No tool use found in response")),B.addNotification?.({text:"Failed to save memory: No tool use found in response",color:"error"});return}let J=o3([await nJ(DH1(W,Y,(V,C)=>MJ5(V,C,I),{options:B.options,abortController:B.abortController,readFileState:{[I]:{content:f1().existsSync(I)?wI(I):"",timestamp:f1().existsSync(I)?f1().statSync(I).mtime.getTime()+1:Date.now()}},setToolJSX:B.setToolJSX,getToolPermissionContext:B.getToolPermissionContext,getQueuedCommands:()=>[],removeQueuedCommands:()=>{},setInProgressToolUseIDs:()=>{},agentId:B.agentId}))])[0];if(J.type==="user"&&J.message.content[0].type==="tool_result"&&J.message.content[0].is_error)throw z1("tengu_add_memory_failure",{}),new Error(J.message.content[0].content);let F=s11(I);if(B.readFileState[I]={content:F,timestamp:f1().statSync(I).mtimeMs},z1("tengu_add_memory_success",{}),aJ({filePath:I,fileContents:G,edits:[{old_string:G,new_string:F,replace_all:\!1}],ignoreWhitespace:\!0}).length>0)B.addNotification?.({jsx:ye1.createElement(nU2,{memoryType:Q,memoryPath:I})},{timeoutMs:1e4});else B.addNotification?.({text:`No changes made to ${O11(Q)} memory`})});async function MJ5(A,B,Q){if(A\!==sJ)return{behavior:"ask",message:"Used incorrect tool"};let{file_path:I}=sJ.inputSchema.parse(B);if(I\!==Q)return{behavior:"ask",message:`Must use correct memory file path: ${Q}`};return{behavior:"allow",updatedInput:B}}function LJ5(){let A=ZA(),B=(A.memoryUsageCount||0)+1;k0({...A,memoryUsageCount:B})}var C6=I1(U1(),1),P9=I1(U1(),1);var o11=I1(U1(),1);function tU2(){let[A,B]=o11.useState(0),[Q,I]=o11.useState({show:\!1}),G=o11.useCallback((Z,D={})=>{let{timeoutMs:Y=8000}=D;B((W)=>{let J=W+1;return I({show:\!0,content:Z}),setTimeout(()=>{B((F)=>{if(J===F)I({show:\!1});return F})},Y),J})},[]);return{notification:Q,addNotification:G}}var $q2=I1(Uq2(),1);function Q1A({message:A,title:B}){let Q=B?`${B}:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ^

Error: Must use correct memory file path: /claude/CLAUDE.md
    at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1976:1009
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async I (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:14088)

Expected Behavior

The \"Save to project memory\" feature should successfully save content to the CLAUDE.md file without path validation errors.

Actual Behavior

The operation fails with a path validation error even when using the correct memory file path.

Environment

  • Platform: Linux 6.1.0-37-amd64 (LXC container)
  • Claude Code version: 1.0.31
  • Running as: root
  • Working directory: /claude
  • Memory file path: /claude/CLAUDE.md
  • Directory permissions: drwxr-xr-x (755) owned by root:root
  • File permissions: -rw-r--r-- (644) owned by root:root

Workaround

Direct file editing using Edit/Write tools works correctly, only the built-in memory save feature is affected.

Additional Context

  • Running inside LXC container as root user
  • The file exists and is writable
  • Direct manipulation via Edit tool works without issues
  • The error appears to be in the path validation logic of the memory save feature (function MJ5)
  • The validation seems to incorrectly reject the correct path

View original on GitHub ↗

21 Comments

sxhmilyoyo · 1 year ago

I had the same issue with the message Failed to save memory: No tool use found in response

Techondorius · 1 year ago

Same here 😢

!Image

marcodluz · 1 year ago

Same issue here on Mac

Techondorius · 1 year ago

I suspect this issue might occur when using Vertex AI and one of the specific models is not available/enabled in the Google Cloud project. This could happen if certain models haven't been activated or don't have proper permissions configured in the GCP project settings.
Maybe Claude3.5 haiku or something.

jan-xyz · 1 year ago

I run into this problem with an AWS Bedrock model

marcodluz · 1 year ago

@jan-xyz Me too

owens-ben · 1 year ago

I found the issue (at least for me, as the error is generic):

nano wasn't installed, or at least not accessible to Claude.

I literally just told Claude "install nano".

Ccheers · 1 year ago
I suspect this issue might occur when using Vertex AI and one of the specific models is not available/enabled in the Google Cloud project. This could happen if certain models haven't been activated or don't have proper permissions configured in the GCP project settings.我怀疑这个问题可能在使用 Vertex AI 时出现,因为某个特定模型在 Google Cloud 项目中不可用或未启用。这可能发生在某些模型未在 GCP 项目设置中激活,或未配置正确的权限。 Maybe Claude3.5 haiku or something.也许是克劳德 3.5 的俳句,或者类似的东西。

same here

RajendraAVerma · 1 year ago

Same issue with mac here

RajendraAVerma · 1 year ago
I found the issue (at least for me, as the error is generic): nano wasn't installed, or at least not accessible to Claude. I literally just told Claude "install nano".

yes, its working

jan-xyz · 1 year ago

It's not working for me.

sE7enLL · 1 year ago
Same here 😢 !Image

same on windows

<img width="412" height="108" alt="Image" src="https://github.com/user-attachments/assets/49bfddbf-ad17-43f0-b946-325630143929" />

Joeldorne · 12 months ago

Same issues here!

mfenderov · 11 months ago

+1 same problem.

Mandelbrotmenge · 11 months ago

This happens when you use claude code via Bedrock or Vertex AI and the fast model is not available.
In Europe for instance we have no 3.5 haiku on Bedrock. I had to set the fast model to sonnet 4.

export ANTHROPIC_SMALL_FAST_MODEL=eu.anthropic.claude-sonnet-4-20250514-v1:0

rube-de · 11 months ago
I found the issue (at least for me, as the error is generic): nano wasn't installed, or at least not accessible to Claude. I literally just told Claude "install nano".

on macOS using brew and adding nano doesn't help sadly

fellnerse · 11 months ago

I have the same issue, none of the above methods work, we have a fast model available.

SilverLiningSL · 11 months ago

Same issue here, tried every mothods but none of these work.

ghost · 11 months ago

thank you for the reports! this should be fixed now

github-actions[bot] · 11 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4717
  2. https://github.com/anthropics/claude-code/issues/3388
  3. https://github.com/anthropics/claude-code/issues/4291

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] · 10 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.