[BUG] claude crashes when using @syntax pointing at an image file in CLAUDE.md

Resolved 💬 3 comments Opened Sep 6, 2025 by dephekt Closed Sep 6, 2025

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When CLAUDE.md had a reference like @file.jpg this resulted in Claude crashing on startup:

$ claude
error: Path contains null bytes
      at s5 (/$bunfs/root/claude:561:1248)

Bun v1.2.19 (Linux x64 baseline)

Thinking I had corrupted my config somehow, I moved .claude elsewhere:

$ mv ~/.claude ~/.claude.backup

But this only resulted in a similar error but now with a stack dump (see below).

Skipping to the end here, the ultimate cause was in my CLAUDE.md file: I had referenced a local image file of an architectural diagram like:

You can find a diagram of the architecture at @architecture-diagram.png

Removing the @architecture-diagram.png resolved the issue. The problem is none of the error handling made clear what the problem was and this took me 30 minutes working through unrelated rabbit holes.

What Should Happen?

Claude should produce a clear error that I've done something fundamentally invalid in CLAUDE.md. The error didn't indicate my CLAUDE.md file or any specific file as being problematic.

Error Messages/Logs

error: Path contains null bytes
      at s5 (/$bunfs/root/claude:561:1248)
556 | `);if(N)Y.originalMessage=Y.message,Y.message=L;else Y=new Error(L);if(Y.shortMessage=M,Y.command=J,Y.escapedCommand=Q,Y.exitCode=B,Y.signal=X,Y.signalDescription=F,Y.stdout=Z,Y.stderr=G,Y.cwd=z,W!==void 0)Y.all=W;if("bufferedData"in Y)delete Y.bufferedData;return Y.failed=!0,Y.timedOut=Boolean(V),Y.isCanceled=K,Y.killed=H&&!V,Y};var HV0=["stdin","stdout","stderr"],T2Y=(Z)=>HV0.some((G)=>Z[G]!==void 0),pc1=(Z)=>{if(!Z)return;let{stdio:G}=Z;if(G===void 0)return HV0.map((Y)=>Z[Y]);if(T2Y(Z))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${HV0.map((Y)=>`\`${Y}\``).join(", ")}`);if(typeof G==="string")return G;if(!Array.isArray(G))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof G}\``);let W=Math.max(G.length,HV0.length);return Array.from({length:W},(Y,X)=>G[X])};import _2Y from"os";var ij=[];ij.push("SIGHUP","SIGINT","SIGTERM");ij.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT | ... truncated 
557 | `)};var O6Y=1e8,M6Y=({env:Z,extendEnv:G,preferLocal:W,localDir:Y,execPath:X})=>{let B=G?{...AV0.env,...Z}:Z;if(W)return hc1({env:B,cwd:Y,execPath:X});return B},El1=(Z,G,W={})=>{let Y=Ml1.default._parse(Z,G,W);if(Z=Y.command,G=Y.args,W=Y.options,W={maxBuffer:O6Y,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:W.cwd||AV0.cwd(),execPath:AV0.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:Ll1,...W},W.env=M6Y(W),W.stdio=pc1(W),AV0.platform==="win32"&&L6Y.basename(Z,".exe")==="cmd")G.unshift("/q");return{file:Z,args:G,options:W,parsed:Y}},H00=(Z,G,W)=>{if(typeof G!=="string"&&!C6Y.isBuffer(G))return W===void 0?void 0:"";if(Z.stripFinalNewline)return fu0(G);return G};function Wd0(Z,G,W){let Y=El1(Z,G,W),X=su0(Z,G),B=tu0(Z,G);Zd0(B,Y.options),tc1(Y.options);let J;try{J=Gd0.spawn(Y.file,Y.args,Y.options)}catch(F){let q=new Gd0.ChildProcess,D=Promise.reject(V00({error:F,stdout:"",stderr:"",all:"",command:X,escapedCommand:B,parsed:Y,timedOut:!1,isCanceled:!1,killed:!1}));r | ... truncated 
558 | `).filter(Boolean));return}if(X.code===1){Y([]);return}let Q=B&&B.trim().length>0,V=X.signal==="SIGTERM"||X.code==="ABORT_ERR",K=X.code==="ERR_CHILD_PROCESS_STDIO_MAXBUFFER",H=X.code===2,I=(V||K||H)&&Q,z=[];if(I){if(z=B.trim().split(`
559 | `).filter(Boolean),z.length>0&&(V||K))z=z.slice(0,-1)}if(y0(`rg error (signal=${X.signal}, code=${X.code}, stderr: ${J}), ${z.length} results`),X.code!==2)U0(X);Y(z)})})}async function Sl1(Z,G,W){try{return(await sP(["-l","."],Z,G)).slice(0,W)}catch{return[]}}var LV0=GZ(async(Z,G,W=[])=>{try{let Y=["--files","--hidden"];W.forEach((V)=>{Y.push("--glob",`!${V}`)});let B=(await sP(Y,Z,G)).length;if(B===0)return 0;let J=Math.floor(Math.log10(B)),Q=Math.pow(10,J);return Math.round(B/Q)*Q}catch(Y){U0(Y instanceof Error?Y:new Error(String(Y)))}}),NV0=null;function _l1(){let Z=CV0();return{mode:Z.mode,path:Z.command,working:NV0?.working??null}}var f6Y=GZ(async()=>{if(NV0!==null)return;let Z=CV0();try{let G=await kZ(Z.command,[...Z.args,"--version"],{timeout:5000}),W=G.code===0&&!!G.stdout&&G.stdout.startsWith("ripgrep ");NV0={working:W,lastTested:Date.now(),config:Z},y0(`Ripgrep first use test: ${W?"PASSED":"FAILED"} (mode=${Z.mode}, path=${Z.command})`),X0("tengu_ripgrep_availability",{working:W?1:0,using_system:Z.m | ... truncated 
560 | `,`
561 | `)[0]||null}catch{return null}}var We1=()=>{if(ZW()==="windows"){let Z=gd0();process.env.SHELL=Z,y0(`Using bash path: "${Z}"`)}},gd0=GZ(()=>{if(process.env.CLAUDE_CODE_GIT_BASH_PATH){if(bd0(process.env.CLAUDE_CODE_GIT_BASH_PATH))return process.env.CLAUDE_CODE_GIT_BASH_PATH;console.error(`Claude Code was unable to find CLAUDE_CODE_GIT_BASH_PATH path "${process.env.CLAUDE_CODE_GIT_BASH_PATH}"`),process.exit(1)}let Z=nIY("git");if(Z){let G=Ge1.join(Z,"..","..","bin","bash.exe");if(bd0(G))return G}console.error("Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\\Program Files\\Git\\bin\\bash.exe"),process.exit(1)}),eP=(Z)=>{let G=hd0.quote([Z]);return mV0(`cygpath -u ${G}`,{shell:gd0()}).toString().trim()},Ye1=(Z)=>{let G=hd0.quote([Z]);return mV0(`cygpath -w ${G}`,{shell:gd0()}).toString().trim()};function s5(Z,G){let W=G??s1()??L0().cwd();if(typeof Z!=="string")t | ... truncated 

error: Path contains null bytes
      at s5 (/$bunfs/root/claude:561:1239)
      at B (/$bunfs/root/claude:2134:2235)
      at B (/$bunfs/root/claude:2134:2271)
      at B (/$bunfs/root/claude:2134:2271)
      at B (/$bunfs/root/claude:2134:2271)
      at B (/$bunfs/root/claude:2134:2271)
      at B (/$bunfs/root/claude:2134:2294)
      at QR9 (/$bunfs/root/claude:2134:2313)
      at Eh (/$bunfs/root/claude:2134:2492)
      at Eh (/$bunfs/root/claude:2134:2554)

Bun v1.2.19 (Linux x64 baseline)

Steps to Reproduce

  1. Create a png file in the root of a project directory.
  2. Create a CLAUDE.md file with an @-reference to the file like @file.png
  3. Start claude from this project root.
  4. Claude should crash.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

1.0.108 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Warp

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗