[BUG] Claude Code CLI suspends (Stopped / suspended (tty output)) and fails to enter raw mode on macOS iTerm2

Resolved 💬 3 comments Opened Nov 18, 2025 by aratak Closed Jan 20, 2026

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?

Here's текст для поля “What’s wrong?”:

---

When I run the interactive claude CLI in iTerm2 on macOS, it immediately becomes a stopped/suspended job and never shows the normal TUI. As soon as the terminal loses focus (Cmd+Tab) it consistently stops and then crashes with a raw-mode error.

Symptoms

  • Running claude in iTerm2 (foreground, no pipes) instantly creates a stopped job:
  • In bash:

``bash
bash-3.2$ claude
[1]+ Stopped claude
``

  • In zsh:

``zsh
% claude
[1] + suspended (tty output) claude
``

  • On exit from the shell, claude wakes up and prints a huge Ink stack trace ending with a raw mode error, e.g.:

``text
error: setRawMode failed with errno: 5
at node:tty:31:42
at handleSetRawMode (/$bunfs/root/claude:218:388)
...
Error: Raw mode is not supported on the stdin provided to Ink.
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported
``

  • The behavior reproduces:
  • in zsh with full config,
  • in /bin/zsh -f (no config, no oh-my-zsh),
  • in plain bash.
  • In iTerm2, the problem is tightly correlated with focus changes:
  • claude is running;
  • I press Cmd+Tab to switch apps during the tool run;
  • immediately, aftet the run see suspended (tty output) / Stopped claude, and on resume I get the raw mode error above.
  • iTerm2 also shows its own warning banner:

> “Looks like focus reporting was left on when an ssh session ended unexpectedly or an app misbehaved. Turn it off?”

which suggests the CLI enables focus reporting / special TTY modes and then crashes without cleaning them up.

What Should Happen?

  • claude should start the interactive TUI in the foreground and keep running normally, even when the terminal window loses/gains focus.
  • Switching apps (Cmd+Tab) should not stop the process or break its TTY state.

Error Messages/Logs

bash-3.2$ claude

[1]+  Stopped                 claude
bash-3.2$ exit
There are stopped jobs.
bash-3.2$ exit
213 | `).join("")}captureString(T,R=this.captureString){if(typeof T==="function")R=T,T=1/0;let{stackTraceLimit:A}=Error;if(T)Error.stackTraceLimit=T;let B={};Error.captureStackTrace(B,R);let{stack:D}=B;return Error.stackTraceLimit=A,this.clean(D)}capture(T,R=this.capture){if(typeof T==="function")R=T,T=1/0;let{prepareStackTrace:A,stackTraceLimit:B}=Error;if(Error.prepareStackTrace=($,H)=>{if(this._wrapCallSite)return H.map(this._wrapCallSite);return H},T)Error.stackTraceLimit=T;let D={};Error.captureStackTrace(D,R);let{stack:_}=D;return Object.assign(Error,{prepareStackTrace:A,stackTraceLimit:B}),_}at(T=this.at){let[R]=this.capture(1,T);if(!R)return{};let A={line:R.getLineNumber(),column:R.getColumnNumber()};if(CUA(A,R.getFileName(),this._cwd),R.isConstructor())Object.defineProperty(A,"constructor",{value:!0,configurable:!0});if(R.isEval())A.evalOrigin=R.getEvalOrigin();if(R.isNative())A.native=!0;let B;try{B=R.getTypeName()}catch($){}if(B&&B!=="Object"&&B!=="[object Object]")A.type=B;let D=R.getFunctionName();if(D | ... truncated
214 | `).slice(1):void 0,A=R?ZUA.parseLine(R[0]):void 0,B=QUA(A?.file),D,_=0;if(B&&A?.line&&EyT.existsSync(B)){let $=EyT.readFileSync(B,"utf8");if(D=XUA($,A.line),D)for(let{line:H}of D)_=Math.max(_,String(H).length)}return dW.default.createElement(U,{flexDirection:"column",padding:1},dW.default.createElement(U,null,dW.default.createElement(Z,{backgroundColor:"error",color:"text"}," ","ERROR"," "),dW.default.createElement(Z,null," ",T.message)),A&&B&&dW.default.createElement(U,{marginTop:1},dW.default.createElement(Z,{dimColor:!0},B,":",A.line,":",A.column)),A&&D&&dW.default.createElement(U,{marginTop:1,flexDirection:"column"},D.map(({line:$,value:H})=>dW.default.createElement(U,{key:$},dW.default.createElement(U,{width:_+1},dW.default.createElement(Z,{dimColor:$!==A.line,backgroundColor:$===A.line?"error":void 0,color:$===A.line?"text":void 0},String($).padStart(_," "),":")),dW.default.createElement(Z,{key:$,backgroundColor:$===A.line?"error":void 0,color:$===A.line?"text":void 0}," "+H)))),T.stack&&dW.default.crea | ... truncated
215 | `).slice(1).map(($)=>{let H=ZUA.parseLine($);if(!H)return dW.default.createElement(U,{key:$},dW.default.createElement(Z,{dimColor:!0},"- "),dW.default.createElement(Z,{dimColor:!0,bold:!0},$));return dW.default.createElement(U,{key:$},dW.default.createElement(Z,{dimColor:!0},"- "),dW.default.createElement(Z,{dimColor:!0,bold:!0},H.function),dW.default.createElement(Z,{dimColor:!0}," ","(",QUA(H.file)??"",":",H.line,":",H.column,")"))})))}var EyT,c5R,dW,d5R,QUA=(T)=>{return T?.replace(`file://${c5R.cwd()}/`,"")},ZUA;var EUA=O(()=>{OUA();hyT();g5R();EyT=V(require("fs")),c5R=require("process"),dW=V(qT(),1),d5R=V(qUA(),1),ZUA=new d5R.default({cwd:c5R.cwd(),internals:d5R.default.nodeInternals()})});function fX1(T){return{name:"",fn:!1,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:T,raw:T,isPasted:!0}}function yX1(T){if(KUA.Buffer.isBuffer(T))if(T[0]>127&&T[1]===void 0)return T[0]-=128,"\x1B"+String(T);else return String(T);else if(T!==void 0&&typeof T!=="string")return String(T);else if(!T)return"";else return T}fun | ... truncated
216 | `)A.name="enter";else if(T==="\t")A.name="tab";else if(T==="\b"||T==="\x1B\b")A.name="backspace",A.meta=T.charAt(0)==="\x1B";else if(T==="\x7F"||T==="\x1B\x7F")A.name="backspace",A.meta=T.charAt(0)==="\x1B";else if(T==="\x1B"||T==="\x1B\x1B")A.name="escape",A.meta=T.length===2;else if(T===" "||T==="\x1B ")A.name="space",A.meta=T.length===2;else if(T==="\x1F")A.name="_",A.ctrl=!0;else if(T<="\x1A"&&T.length===1)A.name=String.fromCharCode(T.charCodeAt(0)+97-1),A.ctrl=!0;else if(T.length===1&&T>="0"&&T<="9")A.name="number";else if(T.length===1&&T>="a"&&T<="z")A.name=T;else if(T.length===1&&T>="A"&&T<="Z")A.name=T.toLowerCase(),A.shift=!0;else if(R=VX1.exec(T))A.meta=!0,A.shift=/^[A-Z]$/.test(R[1]);else if(R=FX1.exec(T)){let B=[...T];if(B[0]==="\x1B"&&B[1]==="\x1B")A.option=!0;let D=[R[1],R[2],R[4],R[6]].filter(Boolean).join(""),_=(R[3]||R[5]||1)-1;A.ctrl=!!(_&4),A.meta=!!(_&10),A.shift=!!(_&1),A.code=D,A.name=VUA[D],A.shift=PX1(D)||A.shift,A.ctrl=bX1(D)||A.ctrl}if(A.raw==="\x1Bb")A.meta=!0,A.name="left";else if( | ... truncated
217 | Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);else throw Error(`Raw mode is not supported on the stdin provided to Ink.
218 | Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(R.setEncoding("utf8"),T){if(this.rawModeEnabledCount===0)R.ref(),R.setRawMode(!0),R.addListener("readable",this.handleReadable),this.props.stdout.write("\x1B[?2004h");this.rawModeEnabledCount++;return}if(--this.rawModeEnabledCount===0)this.props.stdout.write("\x1B[?2004l"),R.setRawMode(!1),R.removeListener("readable",this.handleReadable),R.unref()};flushIncomplete=()=>{if(this.incompleteEscapeTimer=null,!this.keyParseState.incomplete)return;this.processInput(null)};processInput=(T)=>{let[R,A]=YUA(this.keyParseState,T);this.keyParseState=A;for(let B of R){this.handleInput(B.sequence);let D=new KyT(B);this.internal_eventEmitter.emit("input",D)}if(this.keyParseState.incomplete){if(this.incompleteEscapeTimer)clearTimeout(this.incompleteEscapeTimer);this.incompleteEscapeTimer=setTimeout(this.flushIncomplete,this.keyParseState.mode==="IN_PASTE"?this.PASTE_TIMEOUT:this.NORMAL_TIMEOUT)}};handleReadable=()=>{let T;whil | ... truncated

error: setRawMode failed with errno: 5
      at node:tty:31:42
      at handleSetRawMode (/$bunfs/root/claude:218:388)
      at /$bunfs/root/claude:219:346
      at HY (/$bunfs/root/claude:104:20498)
      at AP (/$bunfs/root/claude:104:21356)
      at KO (/$bunfs/root/claude:104:40315)
      at /$bunfs/root/claude:104:39301
      at kIR (/$bunfs/root/claude:98:4534)
      at wIR (/$bunfs/root/claude:98:4952)

213 | `).join("")}captureString(T,R=this.captureString){if(typeof T==="function")R=T,T=1/0;let{stackTraceLimit:A}=Error;if(T)Error.stackTraceLimit=T;let B={};Error.captureStackTrace(B,R);let{stack:D}=B;return Error.stackTraceLimit=A,this.clean(D)}capture(T,R=this.capture){if(typeof T==="function")R=T,T=1/0;let{prepareStackTrace:A,stackTraceLimit:B}=Error;if(Error.prepareStackTrace=($,H)=>{if(this._wrapCallSite)return H.map(this._wrapCallSite);return H},T)Error.stackTraceLimit=T;let D={};Error.captureStackTrace(D,R);let{stack:_}=D;return Object.assign(Error,{prepareStackTrace:A,stackTraceLimit:B}),_}at(T=this.at){let[R]=this.capture(1,T);if(!R)return{};let A={line:R.getLineNumber(),column:R.getColumnNumber()};if(CUA(A,R.getFileName(),this._cwd),R.isConstructor())Object.defineProperty(A,"constructor",{value:!0,configurable:!0});if(R.isEval())A.evalOrigin=R.getEvalOrigin();if(R.isNative())A.native=!0;let B;try{B=R.getTypeName()}catch($){}if(B&&B!=="Object"&&B!=="[object Object]")A.type=B;let D=R.getFunctionName();if(D | ... truncated
214 | `).slice(1):void 0,A=R?ZUA.parseLine(R[0]):void 0,B=QUA(A?.file),D,_=0;if(B&&A?.line&&EyT.existsSync(B)){let $=EyT.readFileSync(B,"utf8");if(D=XUA($,A.line),D)for(let{line:H}of D)_=Math.max(_,String(H).length)}return dW.default.createElement(U,{flexDirection:"column",padding:1},dW.default.createElement(U,null,dW.default.createElement(Z,{backgroundColor:"error",color:"text"}," ","ERROR"," "),dW.default.createElement(Z,null," ",T.message)),A&&B&&dW.default.createElement(U,{marginTop:1},dW.default.createElement(Z,{dimColor:!0},B,":",A.line,":",A.column)),A&&D&&dW.default.createElement(U,{marginTop:1,flexDirection:"column"},D.map(({line:$,value:H})=>dW.default.createElement(U,{key:$},dW.default.createElement(U,{width:_+1},dW.default.createElement(Z,{dimColor:$!==A.line,backgroundColor:$===A.line?"error":void 0,color:$===A.line?"text":void 0},String($).padStart(_," "),":")),dW.default.createElement(Z,{key:$,backgroundColor:$===A.line?"error":void 0,color:$===A.line?"text":void 0}," "+H)))),T.stack&&dW.default.crea | ... truncated
215 | `).slice(1).map(($)=>{let H=ZUA.parseLine($);if(!H)return dW.default.createElement(U,{key:$},dW.default.createElement(Z,{dimColor:!0},"- "),dW.default.createElement(Z,{dimColor:!0,bold:!0},$));return dW.default.createElement(U,{key:$},dW.default.createElement(Z,{dimColor:!0},"- "),dW.default.createElement(Z,{dimColor:!0,bold:!0},H.function),dW.default.createElement(Z,{dimColor:!0}," ","(",QUA(H.file)??"",":",H.line,":",H.column,")"))})))}var EyT,c5R,dW,d5R,QUA=(T)=>{return T?.replace(`file://${c5R.cwd()}/`,"")},ZUA;var EUA=O(()=>{OUA();hyT();g5R();EyT=V(require("fs")),c5R=require("process"),dW=V(qT(),1),d5R=V(qUA(),1),ZUA=new d5R.default({cwd:c5R.cwd(),internals:d5R.default.nodeInternals()})});function fX1(T){return{name:"",fn:!1,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:T,raw:T,isPasted:!0}}function yX1(T){if(KUA.Buffer.isBuffer(T))if(T[0]>127&&T[1]===void 0)return T[0]-=128,"\x1B"+String(T);else return String(T);else if(T!==void 0&&typeof T!=="string")return String(T);else if(!T)return"";else return T}fun | ... truncated
216 | `)A.name="enter";else if(T==="\t")A.name="tab";else if(T==="\b"||T==="\x1B\b")A.name="backspace",A.meta=T.charAt(0)==="\x1B";else if(T==="\x7F"||T==="\x1B\x7F")A.name="backspace",A.meta=T.charAt(0)==="\x1B";else if(T==="\x1B"||T==="\x1B\x1B")A.name="escape",A.meta=T.length===2;else if(T===" "||T==="\x1B ")A.name="space",A.meta=T.length===2;else if(T==="\x1F")A.name="_",A.ctrl=!0;else if(T<="\x1A"&&T.length===1)A.name=String.fromCharCode(T.charCodeAt(0)+97-1),A.ctrl=!0;else if(T.length===1&&T>="0"&&T<="9")A.name="number";else if(T.length===1&&T>="a"&&T<="z")A.name=T;else if(T.length===1&&T>="A"&&T<="Z")A.name=T.toLowerCase(),A.shift=!0;else if(R=VX1.exec(T))A.meta=!0,A.shift=/^[A-Z]$/.test(R[1]);else if(R=FX1.exec(T)){let B=[...T];if(B[0]==="\x1B"&&B[1]==="\x1B")A.option=!0;let D=[R[1],R[2],R[4],R[6]].filter(Boolean).join(""),_=(R[3]||R[5]||1)-1;A.ctrl=!!(_&4),A.meta=!!(_&10),A.shift=!!(_&1),A.code=D,A.name=VUA[D],A.shift=PX1(D)||A.shift,A.ctrl=bX1(D)||A.ctrl}if(A.raw==="\x1Bb")A.meta=!0,A.name="left";else if( | ... truncated
217 | Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);else throw Error(`Raw mode is not supported on the stdin provided to Ink.
218 | Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(R.setEncoding("utf8"),T){if(this.rawModeEnabledCount===0)R.ref(),R.setRawMode(!0),R.addListener("readable",this.handleReadable),this.props.stdout.write("\x1B[?2004h");this.rawModeEnabledCount++;return}if(--this.rawModeEnabledCount===0)this.props.stdout.write("\x1B[?2004l"),R.setRawMode(!1),R.removeListener("readable",this.handleReadable),R.unref()};flushIncomplete=()=>{if(this.incompleteEscapeTimer=null,!this.keyParseState.incomplete)return;this.processInput(null)};processInput=(T)=>{let[R,A]=YUA(this.keyParseState,T);this.keyParseState=A;for(let B of R){this.handleInput(B.sequence);let D=new KyT(B);this.internal_eventEmitter.emit("input",D)}if(this.keyParseState.incomplete){if(this.incompleteEscapeTimer)clearTimeout(this.incompleteEscapeTimer);this.incompleteEscapeTimer=setTimeout(this.flushIncomplete,this.keyParseState.mode==="IN_PASTE"?this.PASTE_TIMEOUT:this.NORMAL_TIMEOUT)}};handleReadable=()=>{let T;whil | ... truncated

error: setRawMode failed with errno: 5
      at node:tty:31:42
      at handleSetRawMode (/$bunfs/root/claude:218:388)
      at /$bunfs/root/claude:219:346
      at HY (/$bunfs/root/claude:104:20498)
      at AP (/$bunfs/root/claude:104:21356)
      at KO (/$bunfs/root/claude:104:40315)
      at /$bunfs/root/claude:104:39301
      at kIR (/$bunfs/root/claude:98:4534)
      at wIR (/$bunfs/root/claude:98:4952)

Steps to Reproduce

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.44

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

suspended (tty output) example:

<img width="784" height="292" alt="Image" src="https://github.com/user-attachments/assets/9673eef0-6502-44b7-951f-253ffb4259c9" />

View original on GitHub ↗

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