claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Incorrect File Path Resolution The issue appears to be with incorrect file path resolution. The developer is trying to access a file, but using inconsistent or incorrect relative paths. The recommended approach is to: 1. Use a consistent, project-relativ

Open danhenders opened this issue 6 months ago • 4 comments

Bug Description claude is looking at the wrong file structre: ⏺ Read(../../../danhanders/Downloads/socialhub.chat_v2/lib/facebook-api-client.ts) ⎿ Error: File does not exist.

⏺ Read(lib/facebook-api-client.ts) ⎿ Read 50 lines (ctrl+r to expand)

⏺ I need to fix all the other methods too:

⏺ Update(../../../danhanders/Downloads/socialhub.chat_v2/lib/facebook-api-client.ts) ⎿ Error: File does not exist. ⎿ Interrupted by user

can I ask why you keep looking for danhanders? my name is danhenders but why dont you just look at the base level of /lib/facebook-api-client.ts is this on claude.md or something else?

⏺ You're absolutely right! I apologize for the confusion. I've been using the full path /Users/danhenders/Downloads/socialhub.chat_v2/lib/facebook-api-client.ts when I should just use /lib/facebook-api-client.ts from the project root. This isn't from claude.md

  • it's just a habit of using the full absolute path that was shown in the initial context.

Let me fix the remaining methods using the correct relative path:

⏺ Update(../../../../lib/facebook-api-client.ts) ⎿ Error: File does not exist.

⏺ Let me try with the correct path:

⏺ List(../../../../lib) ⎿ No (tell Claude what to do differently)

Environment Info

  • Platform: darwin
  • Terminal: cursor
  • Version: 1.0.27
  • Feedback ID: b625261c-5f39-44ed-bc1c-a72789af367a

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at genericNodeError (node:internal/errors:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:892:11)\n    at execSync (node:child_process:964:15)\n    at wZ (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:659:3921)\n    at file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:582:9014\n    at Q (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:526:17199)\n    at QX (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:582:8160)\n    at $S (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:582:7241)\n    at L9 (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:582:11408)","timestamp":"2025-06-18T16:29:10.957Z"},{"error":"RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded\n    at Socket.onChildStdout (node:child_process:482:14)\n    at Socket.emit (node:events:507:28)\n    at Socket.emit (node:domain:489:12)\n    at addChunk (node:internal/streams/readable:559:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)\n    at Readable.push (node:internal/streams/readable:390:5)\n    at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)","timestamp":"2025-06-18T16:29:11.698Z"},{"error":"Error: 1: ENOENT \n    at nP6 (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1326:4493)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async lP6 (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1326:2578)","timestamp":"2025-06-18T16:29:11.944Z"},{"error":"Error: Request was aborted.\n    at no._createMessage (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1306:6810)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-06-18T16:32:45.929Z"},{"error":"Error: ENOENT: no such file or directory, stat '/Users/danhanders/Downloads/socialhub.chat_v2/lib/auth.ts'\n    at Module.statSync (node:fs:1718:25)\n    at Object.statSync (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:536:687)\n    at dxA.readFile (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:536:1919)\n    at sT1 (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:559:39)\n    at kt1 (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1610:275)\n    at PD5 (file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:1150)\n    at file:///Users/danhenders/.claude/local/node_modules/@anthropic-ai/claude-code/cl

Note: Error logs were truncated.

danhenders avatar Jun 18 '25 17:06 danhenders

This is the most frustrating one. The AI system referencing the actual user. Then either does not read the user name properly. For my case "danhenders" which eventually leads them to try read a file incorrect location or save it to file which does not exist. Rather than just project for /app/...

danhenders avatar Jun 20 '25 19:06 danhenders

I am dealing with the same issue. Claude Code keeps trying to access the wrong path with wrong username. I tried giving instrucitons with Claude.md but it didnt work

s0571584 avatar Jun 26 '25 18:06 s0571584

I just tell it to look to use the project files route such /app instead of the users. I have yet to find a solution. It appears here and there. I even considered changing my username on my Mac to just my name Dan instead of Danhenders. It's calls me danhanders haha.

danhenders avatar Jun 26 '25 18:06 danhenders

Happening for me too.

Have an xcode project open, I pass in the full path in the instructions, and claude code skips the first directory in the path.

pbantolas avatar Jun 27 '25 09:06 pbantolas

Same for me. Always switching out the last letter in my username in the absolute filepaths. Been going on for many months. Don't know why and how to fix it. Added a sentence to user memory but its not helping much. It usually starts using filepaths relative to working dir or i have to correct it. Quite annoying.

kjebrak avatar Aug 01 '25 11:08 kjebrak

From what Ive guessed. It seems username and starts hallucinations. So I often see this as chance to clear context and start fresh. I agree it's shouldn't be happening after 3 months. Why do they need to see username and why can't they just see project files within this folder.

danhenders avatar Aug 01 '25 11:08 danhenders

I explained it to claude code and it actually looked for it and found the wrong user name in the cache somewhere from it and removed it, after that I had no problems for a while, when it happens again I will just do the same I guess.

s0571584 avatar Aug 01 '25 12:08 s0571584

@s0571584 wow thats good. Ive just ask claude to do the same.

Worth trying guys: @pbantolas @kjebrak @jackdempsey if you still experience issues and use CC.

Conversations:

Let me check the large .claude.json file which might contain cached context:

⏺ Bash(grep -n "danhanders" ~/.claude.json | head -10) ⎿ 1646: "display": "[Image #1] perfect timing, the other agent Im working with did the same. Search( pattern: "TableCell", path: │ … +23 lines (ctrl+r to expand)

⏺ Found it! The incorrect username "danhanders" is cached in your ~/.claude.json file. This is from previous conversations where the typo was used. Let me update the todos and check if we can clean this cache:

⏺ Update Todos ⎿ ☒ Search for cache files that might contain
'danhanders' ☒ Check hidden directories and AI-related cache ☒ Look for any stored context or memory files ☐ Clean the incorrect username from Claude cache

⏺ I found the issue! The incorrect username "danhanders" is stored in your Claude cache file ~/.claude.json. This file contains conversation history and the typo has been persisted there from previous conversations.

Let me clean this up for you:

⏺ Bash(sed -i.backup 's/danhanders/danhenders/g' ~/.claude.json) ⎿ (No content)

⏺ Let me verify the changes were made:

⏺ Bash(grep -c "danhanders" ~/.claude.json) ⎿ 0

⏺ Perfect! I've successfully cleaned the Claude cache. The incorrect username "danhanders" has been replaced with the correct "danhenders" in your /.claude.json file. I also created a backup file (/.claude.json.backup) just in case.

⏺ Update Todos ⎿ ☒ Search for cache files that might contain
'danhanders' ☒ Check hidden directories and AI-related cache ☒ Clean the incorrect username from Claude cache ☒ Look for any stored context or memory files

⏺ The cache has been cleaned! The typo "danhanders" was stored in your Claude conversation history cache and has now been corrected to "danhenders" throughout the file. This should prevent the AI from picking up the wrong username from cached context in future conversations.

danhenders avatar Aug 01 '25 12:08 danhenders

I remember trying that but it quickly after started hallucinating.

What I figured in my case is, the model really doesn't like when two folders have the same name (happens more often than you think with XCode) - it skips or otherwise hallucinates the top level one.

My fix is to never have the same name for working directory and any other folder inside it.

pbantolas avatar Aug 08 '25 09:08 pbantolas

same issue here:

● Update(../../../../kylebragu/code/.../page/index.tsx)
  ⎿  Error editing file

Claude always drops the 'e' in my name. Eventually it just tries the relative path of the project and gets by.

kylebrague avatar Aug 12 '25 20:08 kylebrague

Anyone here with a workaround? CC mess up for all my prompt because of this.

tetienne avatar Oct 16 '25 09:10 tetienne

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 08 '25 10:12 github-actions[bot]