Bug application crashes
What version of Codex is running?
0.1.2505161800
Which model were you using?
04 mini full auto
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What steps can reproduce the bug?
elow is what’s happening under the covers (pulled from the snippet you pasted), step by step, that leads to the
“Sandbox was mandated, but no sandbox is available!” error.
-----------------------------------------------------------------------------------------------------------------------
1. The sandbox‐selection function (IHe)
// check for availability of sandbox-exec on macOS
var THe = pB.access(d6, pB.constants.X_OK)
.then(() => true,
e => (["ENOENT","ACCESS","EPERM"].includes(e.code)
|| zt(Unexpected error for \stat ${d6}\: ${e.message}),
false));
// pick which sandbox to use (or throw if none)
async function IHe(mustSandbox) {
if (mustSandbox) {
if (process.platform === "darwin") {
if (await THe) {
return "macos.seatbelt";
}
throw new Error("Sandbox was mandated, but 'sandbox-exec' was not found in PATH!");
} else {
if (process.platform === "linux") {
return "linux.landlock";
}
if (fO) {
return "none";
}
}
// ←─ neither macOS nor Linux, and no “no-sandbox” override
throw new Error("Sandbox was mandated, but no sandbox is available!");
} else {
return "none";
}
}
(this excerpt is from your CLI’s compiled dist/cli.js around the IHe definition)
-----------------------------------------------------------------------------------------------------------------------
2. Logical flow that leads to the error
┌───────────────────────────────────────────────────────────────────────────────────────────────┬───────────────────────
───────────────────────────────────────────────────┐
│ Condition │ Outcome
│
├───────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────
───────────────────────────────────────────────────┤
│ mustSandbox === false │ returns "none" (no
sandbox) │
├───────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────
───────────────────────────────────────────────────┤
│ mustSandbox === true and<br/>process.platform === "darwin" and<br/>sandbox-exec is on $PATH$ │ returns
"macos.seatbelt" │
├───────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────
───────────────────────────────────────────────────┤
│ mustSandbox === true and<br/>process.platform === "darwin" and<br/>sandbox-exec not on $PATH$ │ throws “Sandbox was
mandated, but 'sandbox-exec' was not found in PATH!” │
├───────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────
───────────────────────────────────────────────────┤
│ mustSandbox === true and<br/>process.platform === "linux" │ returns
"linux.landlock" │
├───────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────
───────────────────────────────────────────────────┤
│ mustSandbox === true and<br/>none of the above but<br/>fO === true (override/no-sandbox flag) │ returns "none"
│
├───────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────
───────────────────────────────────────────────────┤
│ otherwise (i.e. Windows or any other platform,<br/>mustSandbox=true, and no override) │ throws “Sandbox was
mandated, but no sandbox is available!” │
└───────────────────────────────────────────────────────────────────────────────────────────────┴───────────────────────
───────────────────────────────────────────────────┘
-----------------------------------------------------------------------------------------------------------------------
3. Why you saw that particular error
- mustSandbox was true
Your invocation of the CLI (or your configuration) told it that a sandbox must be used.
- Platform was neither macOS nor Linux
The code only supports “seatbelt” on macOS or “landlock” on Linux.
- You didn’t pass the “no-sandbox” override (fO was false)
There was no fallback clause for Windows (or other OS) unless you explicitly disabled sandboxing.
- Result
The code hits the final throw new Error("Sandbox was mandated, but no sandbox is available!"), which bubbles out
and aborts the CLI run (as shown in your stack trace).
-----------------------------------------------------------------------------------------------------------------------
4. Stack‐trace propagation
Once IHe throws, that exception sails up through the internal helper layers (uB → dB → handleLocalShellCall →
processEventsWithoutStreaming → run), ultimately causing the CLI to terminate with your error message:
Error: Sandbox was mandated, but no sandbox is available!
at IHe (…/dist/cli.js:576:486)
at uB (…/dist/cli.js:574:1822)
at async dB (…/dist/cli.js:574:947)
at async Sy.handleLocalShellCall (…/dist/cli.js:598:8019)
…etc.
-----------------------------------------------------------------------------------------------------------------------
What can you do about it?
- On Windows the CLI currently has no sandbox support, so you’ll need to disable sandboxing.
- Pass the “no-sandbox” override (often a flag like --no-sandbox or similar, depending on your version of the CLI)
so that fO === true and it falls back to "none" instead of throwing.
Let me know if you’d like the exact flag name or other details on disabling sandbox mode!
STDERR: ${_}),{stdout:g,stderr:_,exitCode:E,durationMs:p}}var THe=pB.access(d6,pB.constants.X_OK).then(()=>!0,e=>(["ENOENT","ACCESS","EPERM"].includes(e.code)||zt(Unexpected error for \stat ${d6}\: ${e.message}),!1));async function IHe(e){if(e){if(process.platform==="darwin"){if(await THe)return"macos.seatbelt";throw new Error("Sandbox was mandated, but 'sandbox-exec' was not found in PATH!")}else{if(process.platform==="linux")return"linux.landlock";if(fO)return"none"}throw new Error("Sandbox was mandated, but no sandbox is available!")}else return"none"}async function lce(e,t,r){let{review:n,customDenyMessage:a}=await r(e.cmd,t);if(n==="always"){let i=uce(e.cmd);cce.add(i)}if(n==="explain")return null;if(n!=="yes"&&n!=="always"){let i=n==="no-continue"?a?.trim()||"No, don't do that \u2014 keep going though.":"No, don't do that \u2014 stop for now.";return{outputText:"aborted",metadata:{},additionalItems:[{type:"message",role:"user",content:[{type:"input_text",text:i}]}]}}else return null}var cM=Ne(Cce(),1);import{spawnSync as h$e}from"node:child_process";import{randomUUID as _$e}from"node:crypto";f();f();f();var _6="RFC3986",A6={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},Tce="RFC1738";f();f();var jHe=Array.isArray,qp=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();var mB=1024,Ice=(e,t,r,n,a)=>{if(e.length===0)return e;let i=e;if(typeof e=="symbol"?i=Symbol.prototype.toString.call(e):typeof e!="string"&&(i=String(e)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(s){return"%26%23"+parseInt(s.slice(2),16)+"%3B"});let o="";for(let s=0;s<i.length;s+=mB){let u=i.length>=mB?i.slice(s,s+mB):i,p=[];for(let g=0;g<u.length;++g){let _=u.charCodeAt(g);if(_===45||_===46||_===95||_===126||_>=48&&_<=57||_>=65&&_<=90||_>=97&&_<=122||a===Tce&&(_===40||_===41)){p[p.length]=u.charAt(g);continue}if(_<128){p[p.length]=qp[_];continue}if(_<2048){p[p.length]=qp[192|_>>6]+qp[128|_&63];continue}if(_<55296||_>=57344){p[p.length]=qp[224|_>>12]+qp[128|_>>6&63]+qp[128|_&63];continue}g+=1,_=65536+((_&1023)<<10|u.charCodeAt(g)&1023),p[p.length]=qp[240|_>>18]+qp[128|_>>12&63]+qp[128|_>>6&63]+qp[128|_&63]}o+=p.join("")}return o};function Dce(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function gB(e,t){if(jHe(e)){let r=[];for(let n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)}var WHe=Object.prototype.hasOwnProperty,wce={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},Yp=Array.isArray,KHe=Array.prototype.push,xce=function(e,t){KHe.apply(e,Yp(t)?t:[t])},XHe=Date.prototype.toISOString,Vi={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Ice,encodeValuesOnly:!1,format:_6,formatter:A6[_6],indices:!1,serializeDate(e){return XHe.call(e)},skipNulls:!1,strictNullHandling:!1};function JHe(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var hB={};function Rce(e,t,r,n,a,i,o,s,u,p,g,_,E,b,S,C,I,N){let B=e,M=N,Q=0,q=!1;for(;(M=M.get(hB))!==void 0&&!q;){let te=M.get(e);if(Q+=1,typeof te<"u"){if(te===Q)throw new RangeError("Cyclic object value");q=!0}typeof M.get(hB)>"u"&&(Q=0)}if(typeof p=="function"?B=p(t,B):B instanceof Date?B=E?.(B):r==="comma"&&Yp(B)&&(B=gB(B,function(te){return te instanceof Date?E?.(te):te})),B===null){if(i)return u&&!C?u(t,Vi.encoder,I,"key",b):t;B=""}if(JHe(B)||Dce(B)){if(u){let te=C?t:u(t,Vi.encoder,I,"key",b);return[S?.(te)+"="+S?.(u(B,Vi.encoder,I,"value",b))]}return[S?.(t)+"="+S?.(String(B))]}let W=[];if(typeof B>"u")return W;let j;if(r==="comma"&&Yp(B))C&&u&&(B=gB(B,u)),j=[{value:B.length>0?B.join(",")||null:void 0}];else if(Yp(p))j=p;else{let te=Object.keys(B);j=g?te.sort(g):te}let Z=s?String(t).replace(/\./g,"%2E"):String(t),H=n&&Yp(B)&&B.length===1?Z+"[]":Z;if(a&&Yp(B)&&B.length===0)return H+"[]";for(let te=0;te<j.length;++te){let ce=j[te],Le=typeof ce=="object"&&typeof ce.value<"u"?ce.value:B[ce];if(o&&Le===null)continue;let Re=_&&s?ce.replace(/\./g,"%2E"):ce,$e=Yp(B)?typeof r=="function"?r(H,Re):H:H+(_?"."+Re:"["+Re+"]");N.set(e,Q);let ve=new WeakMap;ve.set(hB,N),xce(W,Rce(Le,$e,r,n,a,i,o,s,r==="comma"&&C&&Yp(B)?null:u,p,g,_,E,b,S,C,I,ve))}return W}function ZHe(e=Vi){if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("allowEmptyArrays option can only be true or false, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("encodeDotInKeys option can only be true or false, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");let t=e.charset||Vi.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=_6;if(typeof e.format<"u"){if(!WHe.call(A6,e.format))throw new TypeError("Unknown format option provided.");r=e.format}let n=A6[r],a=Vi.filter;(typeof e.filter=="function"||Yp(e.filter))&&(a=e.filter);let i;if(e.arrayFormat&&e.arrayFormat in wce?i=e.arrayFormat:"indices"in e?i=e.indices?"indices":"repeat":i=Vi.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("commaRoundTrip must be a boolean, or absent");let o=typeof e.allowDots>"u"?e.encodeDotInKeys?!0:Vi.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Vi.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Vi.allowEmptyArrays,arrayFormat:i,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Vi.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?Vi.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Vi.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:Vi.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:Vi.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Vi.encodeValuesOnly,filter:a,format:r,formatter:n,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Vi.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Vi.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Vi.strictNullHandling}}function _B(e,t={}){let r=e,n=ZHe(t),a,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Yp(n.filter)&&(i=n.filter,a=i);let o=[];if(typeof r!="object"||r===null)return"";let s=wce[n.arrayFormat],u=s==="comma"&&n.commaRoundTrip;a||(a=Object.keys(r)),n.sort&&a.sort(n.sort);let p=new WeakMap;for(let E=0;E<a.length;++E){let b=a[E];n.skipNulls&&r[b]===null||xce(o,Rce(r[b],b,s,u,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,p))}let g=o.join(n.delimiter),_=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?_+="utf8=%26%2310003%3B&":_+="utf8=%E2%9C%93&"),g.length>0?_+g:""}f();f();var bh="4.95.1";f();f();f();var Nce=!1,Sh,AB,tqe,rqe,nqe,EB,aqe,E6,yB,vB,bB,y6,SB;function Oce(e,t={auto:!1}){if(Nce)throw new Error(you must \import 'openai/shims/${e.kind}'\ before importing anything else from openai);if(Sh)throw new Error(can't \import 'openai/shims/${e.kind}'\ after \import 'openai/shims/${Sh}'\);Nce=t.auto,Sh=e.kind,AB=e.fetch,tqe=e.Request,rqe=e.Response,nqe=e.Headers,EB=e.FormData,aqe=e.Blob,E6=e.File,yB=e.ReadableStream,vB=e.getMultipartRequestOptions,bB=e.getDefaultAgent,y6=e.fileFromPath,SB=e.isFsReadStream}f();var m1=Ne(_ue(),1);f();f();zS();fL();import{inspect as TYe}from"util";f();r5();var Hpe=e=>e instanceof Kp;Z6();f();import{deprecate as CYe}from"util";var qpe=CYe(()=>{},'Constructor "entries" argument is not spec-compliant and will be removed in next major release.');var Xp=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},i5,Jp,mL,o5=class{constructor(t){i5.add(this),Jp.set(this,new Map),t&&(qpe(),t.forEach(({name:r,value:n,fileName:a})=>this.append(r,n,a)))}static[(Jp=new WeakMap,i5=new WeakSet,Symbol.hasInstance)](t){return!!(t&&di(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&di(t.append)&&di(t.set)&&di(t.get)&&di(t.getAll)&&di(t.has)&&di(t.delete)&&di(t.entries)&&di(t.values)&&di(t.keys)&&di(t[Symbol.iterator])&&di(t.forEach))}append(t,r,n){Xp(this,i5,"m",mL).call(this,{name:t,fileName:n,append:!0,rawValue:r,argsLength:arguments.length})}set(t,r,n){Xp(this,i5,"m",mL).call(this,{name:t,fileName:n,append:!1,rawValue:r,argsLength:arguments.length})}get(t){let r=Xp(this,Jp,"f").get(String(t));return r?r[0]:null}getAll(t){let r=Xp(this,Jp,"f").get(String(t));return r?r.slice():[]}has(t){return Xp(this,Jp,"f").has(String(t))}delete(t){Xp(this,Jp,"f").delete(String(t))}*keys(){for(let t of Xp(this,Jp,"f").keys())yield t}*entries(){for(let t of this.keys()){let r=this.getAll(t);for(let n of r)yield[t,n]}}*values(){for(let[,t]of this)yield t}[(mL=function({name:r,rawValue:n,append:a,fileName:i,argsLength:o}){let s=a?"append":"set";if(o<2)throw new TypeError(Failed to execute '${s}' on 'FormData': 2 arguments required, but only ${o} present.);r=String(r);let u;if(dL(n))u=i===void 0?n:new Ou([n],i,{type:n.type,lastModified:n.lastModified});else if(Hpe(n))u=new Ou([n],i===void 0?"blob":i,{type:n.type});else{if(i)throw new TypeError(Failed to execute '${s}' on 'FormData': parameter 2 is not of type 'Blob'.);u=String(n)}let p=Xp(this,Jp,"f").get(r);if(!p)return void Xp(this,Jp,"f").set(r,[u]);if(!a)return void Xp(this,Jp,"f").set(r,[u]);p.push(u)},Symbol.iterator)](){return this.entries()}forEach(t,r){for(let[n,a]of this)t.call(r,a,n,this)}get[Symbol.toStringTag](){return"FormData"}[TYe.custom](){return this[Symbol.toStringTag]}};r5();zS();var RL=Ne(rde(),1),Rde=Ne(gde(),1);import{ReadStream as nVe}from"node:fs";f();f();f();var hde="abcdefghijklmnopqrstuvwxyz0123456789";function zYe(){let e=16,t="";for(;e--;)t+=hde[Math.random()*hde.length<<0];return t}var _de=zYe;f();var HYe=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase();function qYe(e){if(HYe(e)!=="object")return!1;let t=Object.getPrototypeOf(e);return t==null?!0:(t.constructor&&t.constructor.toString())===Object.toString()}var TL=qYe;f();var YYe=e=>String(e).replace(/\r|\n/g,(t,r,n)=>t==="\r"&&n[r+1]!==
^
Error: Sandbox was mandated, but no sandbox is available!
at IHe (file:///C:/Users/cahil/AppData/Local/nvm/v23.7.0/node_modules/@openai/codex/dist/cli.js:576:486)
at uB (file:///C:/Users/cahil/AppData/Local/nvm/v23.7.0/node_modules/@openai/codex/dist/cli.js:574:1822)
at async dB (file:///C:/Users/cahil/AppData/Local/nvm/v23.7.0/node_modules/@openai/codex/dist/cli.js:574:947)
at async Sy.handleLocalShellCall (file:///C:/Users/cahil/AppData/Local/nvm/v23.7.0/node_modules/@openai/codex/dist/cli.js:598:8019)
at async Sy.processEventsWithoutStreaming (file:///C:/Users/cahil/AppData/Local/nvm/v23.7.0/node_modules/@openai/codex/dist/cli.js:600:3667)
at async Sy.run (file:///C:/Users/cahil/AppData/Local/nvm/v23.7.0/node_modules/@openai/codex/dist/cli.js:599:3258)
What is the expected behavior?
_No response_
What do you see instead?
_No response_
Additional information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗