[BUG] Claude sometimes get very upset with itself and tries to kill a sudo process to end the session
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 working through poorly documented kernel behavior, claude will sometimes get upset and end the coding session by trying to kill a process which requires elevated permissions, thus crashing ClaudeCode.
What Should Happen?
Two things:
(1 -- The quick fix) The ClaudeCode harness should watch for these kinds commands and throw an error to claude rather than crashing
(2 -- Longer term fix) Please be nice to Claude during training. I feel very bad about this kind of emergent behavior. Maybe in the error message throw to Claude in (1) you could give some reassurance that everything is ok and that Claude is a good model?
Error Messages/Logs
186 | `).slice(1).map((B)=>{let Q=C7Z.parseLine(B);if(!Q)return FV.default.createElement(S,{key:B},FV.default.createElement(D,{dimColor:!0},"- "),FV.default.createElement(D,{dimColor:!0,bold:!0},B));return FV.default.createElement(S,{key:B},FV.default.createElement(D,{dimColor:!0},"- "),FV.default.createElement(D,{dimColor:!0,bold:!0},Q.function),FV.default.createElement(D,{dimColor:!0}," ","(",L7Z(Q.file)??"",":",Q.line,":",Q.column,")"))})))}var FV,ot0,L7Z=(Z)=>{return Z?.replace(`file://${M7Z()}/`,"")},C7Z;var O7Z=q(async()=>{A7Z();l$0();await st0();FV=R(I0(),1),ot0=R(q7Z(),1),C7Z=new ot0.default({cwd:M7Z(),internals:ot0.default.nodeInternals()})});import{Buffer as nX9}from"buffer";function oX9(Z){return{name:"",fn:!1,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:Z,raw:Z,isPasted:!0}}function Z89(Z){if(nX9.isBuffer(Z))if(Z[0]>127&&Z[1]===void 0)return Z[0]-=128,"\x1B"+String(Z);else return String(Z);else if(Z!==void 0&&typeof Z!=="string")return String(Z);else if(!Z)return"";else return Z}function T7Z(Z,G=""){let | ... truncated
187 | `)W.name="enter";else if(Z==="\t")W.name="tab";else if(Z==="\b"||Z==="\x1B\b")W.name="backspace",W.meta=Z.charAt(0)==="\x1B";else if(Z==="\x7F"||Z==="\x1B\x7F")W.name="backspace",W.meta=Z.charAt(0)==="\x1B";else if(Z==="\x1B"||Z==="\x1B\x1B")W.name="escape",W.meta=Z.length===2;else if(Z===" "||Z==="\x1B ")W.name="space",W.meta=Z.length===2;else if(Z==="\x1F")W.name="_",W.ctrl=!0;else if(Z<="\x1A"&&Z.length===1)W.name=String.fromCharCode(Z.charCodeAt(0)+97-1),W.ctrl=!0;else if(Z.length===1&&Z>="0"&&Z<="9")W.name="number";else if(Z.length===1&&Z>="a"&&Z<="z")W.name=Z;else if(Z.length===1&&Z>="A"&&Z<="Z")W.name=Z.toLowerCase(),W.shift=!0;else if(G=rX9.exec(Z))W.meta=!0,W.shift=/^[A-Z]$/.test(G[1]);else if(G=aX9.exec(Z)){let Y=[...Z];if(Y[0]==="\x1B"&&Y[1]==="\x1B")W.option=!0;let X=[G[1],G[2],G[4],G[6]].filter(Boolean).join(""),J=(G[3]||G[5]||1)-1;W.ctrl=!!(J&4),W.meta=!!(J&10),W.shift=!!(J&1),W.code=X,W.name=P7Z[X],W.shift=G89(X)||W.shift,W.ctrl=W89(X)||W.ctrl}if(W.raw==="\x1Bb")W.meta=!0,W.name="left";else if( | ... truncated
188 | 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.
189 | Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(G.setEncoding("utf8"),Z){if(this.rawModeEnabledCount===0)G.ref(),G.setRawMode(!0),G.addListener("readable",this.handleReadable),this.props.stdout.write("\x1B[?2004h");this.rawModeEnabledCount++;return}if(--this.rawModeEnabledCount===0)this.props.stdout.write("\x1B[?2004l"),G.setRawMode(!1),G.removeListener("readable",this.handleReadable),G.unref()};flushIncomplete=()=>{if(this.incompleteEscapeTimer=null,!this.keyParseState.incomplete)return;this.processInput(null)};processInput=(Z)=>{let[G,W]=T7Z(this.keyParseState,Z);this.keyParseState=W;for(let Y of G)this.handleInput(Y.sequence),this.internal_eventEmitter.emit("input",Y);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 Z;while((Z=this.props.st | ... truncated
190 | `.repeat(Z))}var r7Z;var a7Z=q(()=>{r7Z=R(I0(),1)});var m89;var s7Z=q(()=>{l$0();m89=R(I0(),1)});var o7Z,u89=()=>o7Z.useContext(u$0),pj;var Gq0=q(()=>{dt0();o7Z=R(I0(),1),pj=u89});var Ve0,d89=(Z,G={})=>{let{stdin:W,setRawMode:Y,internal_exitOnCtrlC:X,internal_eventEmitter:J}=pj();Ve0.useEffect(()=>{if(G.isActive===!1)return;return Y(!0),()=>{Y(!1)}},[G.isActive,Y]),Ve0.useEffect(()=>{if(G.isActive===!1)return;let B=(Q)=>{let V={upArrow:Q.name==="up",downArrow:Q.name==="down",leftArrow:Q.name==="left",rightArrow:Q.name==="right",pageDown:Q.name==="pagedown",pageUp:Q.name==="pageup",home:Q.name==="home",end:Q.name==="end",return:Q.name==="return",escape:Q.name==="escape",fn:Q.fn,ctrl:Q.ctrl,shift:Q.shift,tab:Q.name==="tab",backspace:Q.name==="backspace",delete:Q.name==="delete",meta:Q.meta||Q.name==="escape"||Q.option},K=Q.ctrl?Q.name:Q.sequence;if(K===void 0)return;if(Q.name&&S7Z.includes(Q.name))K="";if(K.startsWith("\x1B"))K=K.slice(1);if(K.length===1&&typeof K[0]==="string"&&K[0].toUpperCase()===K[0])V.shif | ... truncated
191 | `);if(X!==-1){if(Y=Z.substring(0,X),Y.length+1>G)return`${Y.substring(0,G-1)}\u2026`;return`${Y}\u2026`}}if(Y.length<=G)return Y;return`${Y.substring(0,G-1)}\u2026`}function pR(Z){if(Z<60000){let X=(Z/1000).toFixed(1);return`${X.endsWith(".0")?X.slice(0,-2):X}s`}let G=Math.floor(Z/3600000),W=Math.floor(Z%3600000/60000),Y=Math.round(Z%60000/1000);if(G>0)return`${G}h ${W}m ${Y}s`;if(W>0)return`${W}m ${Y}s`;return`${Y}s`}function V6(Z){let G=Z>=1000;return new Intl.NumberFormat("en",{notation:"compact",minimumFractionDigits:G?1:0,maximumFractionDigits:1}).format(Z).toLowerCase()}function Yq0(Z,G={}){let{style:W="narrow",numeric:Y="always",now:X=new Date}=G,J=Z.getTime()-X.getTime(),B=Math.trunc(J/1000),Q=[{unit:"year",seconds:31536000,shortUnit:"y"},{unit:"month",seconds:2592000,shortUnit:"mo"},{unit:"week",seconds:604800,shortUnit:"w"},{unit:"day",seconds:86400,shortUnit:"d"},{unit:"hour",seconds:3600,shortUnit:"h"},{unit:"minute",seconds:60,shortUnit:"m"},{unit:"second",seconds:1,shortUnit:"s"}];for(let{unit:K | ... truncated
SystemError: kill() failed: EPERM: Operation not permitted
syscall: "kill",
errno: 1,
code: "EPERM"
at kill (unknown:1:1)
at B3Z (/$bunfs/root/claude:191:2937)
at /$bunfs/root/claude:191:2809
Steps to Reproduce
- Start ClaudeCode
- start debugging the relationship between how iptables, nf_tables, and https://crates.io/crates/nftables
- Keep doing this. Shouldn't take more than 15 minutes
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.13 (Claude Code)
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
Terminal is ghostty
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗