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
- Run Claude Code in interactive mode
- Try to save information to project memory (with #)
- 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
21 Comments
I had the same issue with the message
Failed to save memory: No tool use found in responseSame here 😢
!Image
Same issue here on Mac
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.
I run into this problem with an AWS Bedrock model
@jan-xyz Me too
I found the issue (at least for me, as the error is generic):
nanowasn't installed, or at least not accessible to Claude.I literally just told Claude "install nano".
same here
Same issue with mac here
yes, its working
It's not working for me.
same on windows
<img width="412" height="108" alt="Image" src="https://github.com/user-attachments/assets/49bfddbf-ad17-43f0-b946-325630143929" />
Same issues here!
+1 same problem.
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
on macOS using brew and adding nano doesn't help sadly
I have the same issue, none of the above methods work, we have a fast model available.
Same issue here, tried every mothods but none of these work.
thank you for the reports! this should be fixed now
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
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.