Sandbox was mandated, but no sandbox is available!

Resolved 💬 24 comments Opened Apr 17, 2025 by sevonade4 Closed Aug 7, 2025
💡 Likely answer: A maintainer (tibo-openai, collaborator) responded on this thread — see the highlighted reply below.

Error: Sandbox was mandated, but no sandbox is available!
at Q3e (file:///C:/Users/username/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:439:254)
at async EN (file:///C:/Users/username/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:437:5568)
at async Tte (file:///C:/Users/username/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:437:4863)
at async R0.handleFunctionCall (file:///C:/Users/username/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:461:3960)
at async R0.processEventsWithoutStreaming (file:///C:/Users/username/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:462:4719)
at async R0.run (file:///C:/Users/username/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:462:3045)

View original on GitHub ↗

23 Comments

tibo-openai collaborator · 1 year ago

Apologies, sandboxing is currently not supported on Windows. What was the command you ran?

sevonade4 · 1 year ago

I use o4-mini model and set the approval to full auto.

As for the prompt I told it to learn my codebase and then create a new directory and work on inside that directory.

steven-forresttechnologies · 1 year ago

Can confirm the same error, codex was working on a dotnet 9 program without specifying full-auto just fine. Ran again with mode set to full-auto and repeatedly run into the same error :

Error: Sandbox was mandated, but no sandbox is available!
at Q3e.....

jonchurch contributor · 1 year ago

This was likely fixed by https://github.com/openai/codex/pull/261

Can you build from source and try again? It will be released likely today (not something I hav viz into)

This fix should opt out of sandbox on WIndows

ishyv · 1 year ago

The error was not fixed, it crashes when trying to do anything regarding the codebase in Windows.

╭──────────────────────────────────────────────────────────────╮
│ ● OpenAI Codex (research preview) v0.1.2504161551            │
╰──────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────╮
│ localhost session: 108c5e94758a4b3496f798f8d105bf26          │
│ ↳ workdir: C:\Users\Hyvnt\T\Rust\file-explorer               │
│ ↳ model: o4-mini                                             │
│ ↳ approval: full-auto                                        │
user
Try understanding this codebase
Error: Sandbox was mandated, but no sandbox is available!
    at Q3e (file:///C:/Users/Hyvnt/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:439:254)
    at async EN (file:///C:/Users/Hyvnt/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:437:5568)
    at async Tte (file:///C:/Users/Hyvnt/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:437:4863)
    at async R0.handleFunctionCall (file:///C:/Users/Hyvnt/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:461:3960)
    at async R0.processEventsWithoutStreaming (file:///C:/Users/Hyvnt/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:462:4719)
    at async R0.run (file:///C:/Users/Hyvnt/AppData/Roaming/npm/node_modules/@openai/codex/dist/cli.js:462:3045)

Node.js v22.13.1
cravecra · 1 year ago

I saw sometimes codex pops up a wls terminal and process well but othera just sends this error

jonchurch contributor · 1 year ago

@cravecra what version are you reproing on? 0.1.2504172351?

And you're running from Windows directly, not inside WSL?

There must be a platform detection issue, you can see the codepaths here:
https://github.com/openai/codex/blob/8e2e77fafb5f3b166622c0cae11fc1143ced276a/codex-cli/src/utils/agent/handle-exec-command.ts#L274-L302

Sunwood-ai-labs · 1 year ago

I encountered the following error when running Codex with the --full-auto option in a GitHub Actions Ubuntu environment:

Error: Sandbox was mandated, but no sandbox is available!
    at hOe (file:///usr/local/lib/node_modules/@openai/codex/dist/cli.js:468:433)
    at iO (file:///usr/local/lib/node_modules/@openai/codex/dist/cli.js:466:2281)
    at $ne (file:///usr/local/lib/node_modules/@openai/codex/dist/cli.js:466:1418)
    at dE.handleFunctionCall (file:///usr/local/lib/node_modules/@openai/codex/dist/cli.js:490:4648)
    at dE.processEventsWithoutStreaming (file:///usr/local/lib/node_modules/@openai/codex/dist/cli.js:492:3562)
    at dE.run (file:///usr/local/lib/node_modules/@openai/codex/dist/cli.js:491:3235)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async F$e (file:///usr/local/lib/node_modules/@openai/codex/dist/cli.js:789:516)
    at async file:///usr/local/lib/node_modules/@openai/codex/dist/cli.js:788:827

This appears to be similar to issues other users have reported. While this error has been primarily reported on Windows systems, I've confirmed it also occurs in Linux environments.

🔍 Debug Information

System Environment

Linux fv-az1336-138 6.11.0-1012-azure #12~24.04.1-Ubuntu SMP Mon Mar 10 19:00:39 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
PRETTY_NAME="Ubuntu 24.04.2 LTS"
VERSION_ID="24.04"

Node.js & Codex Information

Node.js: v20.19.1
Codex Version: 0.1.2504301751

Sandbox Related

/proc/1/cgroup file: ✅ Exists

0::/init.scope

!Image

christopherok · 1 year ago

This appears to be similar to issues other users have reported.
I encountered the following error when running Codex with the --dangerously-auto-approve-everything and --approval-mode full-auto on windows WSL2.

Error: Sandbox was mandated, but no sandbox is available!
at hOe (file:///home/chris/.nvm/versions/node/v22.14.0/lib/node_modules/@openai/codex/dist/cli.js:468:433)
at iO (file:///home/chris/.nvm/versions/node/v22.14.0/lib/node_modules/@openai/codex/dist/cli.js:466:2281)
at $ne (file:///home/chris/.nvm/versions/node/v22.14.0/lib/node_modules/@openai/codex/dist/cli.js:466:1418)
at dE.handleFunctionCall (file:///home/chris/.nvm/versions/node/v22.14.0/lib/node_modules/@openai/codex/dist/cli.js:490:4648)
at dE.processEventsWithoutStreaming (file:///home/chris/.nvm/versions/node/v22.14.0/lib/node_modules/@openai/codex/dist/cli.js:492:3562)
at dE.run (file:///home/chris/.nvm/versions/node/v22.14.0/lib/node_modules/@openai/codex/dist/cli.js:491:3235)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

🔍 Debug Information
System Environment
Linux windoze 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
PRETTY_NAME="Ubuntu 24.04.2 LTS"
VERSION_ID="24.04"

Node.js & Codex Information
Node.js: v22.14.0
Codex Version: 0.1.2504301751

rous100 · 1 year ago

Same exact issue on WSL2, Codex CLI 0.1.2504301751

model: o4-mini
approval: full-auto

Error: Sandbox was mandated, but no sandbox is available!
    at hOe (file:///home/user/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:468:433)
    at iO (file:///home/user/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:466:2281)
    at $ne (file:///home/user/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:466:1418)
    at dE.handleFunctionCall (file:///home/user/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:490:4648)
    at dE.processEventsWithoutStreaming (file:///home/user/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:492:3562)
    at dE.run (file:///home/user/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:491:3235)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
fezsid · 1 year ago

I face the same issue on linux

ArchSenex · 1 year ago

Yeah, I was running just fine earlier, got an update notice and took it, and now getting "Error: Sandbox was mandated, but no sandbox is available!" on latest. Windows with WSL Ubuntu 24.04.2 LTS. Hadn't had this problem since I started using Codex last week. Rolled back to v0.1.2504172351 and issue seems to have gone away

Vermath · 1 year ago

I'm getting a similar issue.

Here's what prints in console:

file:///home/[user]/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:468
STDERR: ${A}
),{stdout:f,stderr:A,exitCode:h,durationMs:d}}var AOe=oO.access(a4,oO.constants.X_OK).then(()=>!0,e=>(["ENOENT","ACCESS","EPERM"].includes(e.code)||jt(Unexpected error for \stat ${a4}\: ${e.message}),!1));async function hOe(e){if(e){if(process.platform==="darwin"){if(await AOe)return"macos.seatbelt";throw new Error("Sandbox was mandated, but 'sandbox-exec' was not found in PATH!")}else if(iR)return"none";throw new Error("Sandbox was mandated, but no sandbox is available!")}else return"none"}async function qne(e,t,r){let{review:n,customDenyMessage:a}=await r(e.cmd,t);if(n==="always"){let i=Wne(e.cmd);Vne.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}import{randomUUID as Uke}from"node:crypto";m();m();m();var o4="RFC3986",s4={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},Kne="RFC1738";m();m();var EOe=Array.isArray,Sd=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();var sO=1024,jne=(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(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});let o="";for(let c=0;c<i.length;c+=sO){let d=i.length>=sO?i.slice(c,c+sO):i,f=[];for(let A=0;A<d.length;++A){let h=d.charCodeAt(A);if(h===45||h===46||h===95||h===126||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||a===Kne&&(h===40||h===41)){f[f.length]=d.charAt(A);continue}if(h<128){f[f.length]=Sd[h];continue}if(h<2048){f[f.length]=Sd[192|h>>6]+Sd[128|h&63];continue}if(h<55296||h>=57344){f[f.length]=Sd[224|h>>12]+Sd[128|h>>6&63]+Sd[128|h&63];continue}A+=1,h=65536+((h&1023)<<10|d.charCodeAt(A)&1023),f[f.length]=Sd[240|h>>18]+Sd[128|h>>12&63]+Sd[128|h>>6&63]+Sd[128|h&63]}o+=f.join("")}return o};function Xne(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function lO(e,t){if(EOe(e)){let r=[];for(let n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)}var yOe=Object.prototype.hasOwnProperty,Jne={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},Dd=Array.isArray,COe=Array.prototype.push,Zne=function(e,t){COe.apply(e,Dd(t)?t:[t])},SOe=Date.prototype.toISOString,Gi={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:jne,encodeValuesOnly:!1,format:o4,formatter:s4[o4],indices:!1,serializeDate(e){return SOe.call(e)},skipNulls:!1,strictNullHandling:!1};function DOe(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var cO={};function eae(e,t,r,n,a,i,o,c,d,f,A,h,S,C,b,w,I,O){let B=e,U=O,G=0,j=!1;for(;(U=U.get(cO))!==void 0&&!j;){let le=U.get(e);if(G+=1,typeof le<"u"){if(le===G)throw new RangeError("Cyclic object value");j=!0}typeof U.get(cO)>"u"&&(G=0)}if(typeof f=="function"?B=f(t,B):B instanceof Date?B=S?.(B):r==="comma"&&Dd(B)&&(B=lO(B,function(le){return le instanceof Date?S?.(le):le})),B===null){if(i)return d&&!w?d(t,Gi.encoder,I,"key",C):t;B=""}if(DOe(B)||Xne(B)){if(d){let le=w?t:d(t,Gi.encoder,I,"key",C);return[b?.(le)+"="+b?.(d(B,Gi.encoder,I,"value",C))]}return[b?.(t)+"="+b?.(String(B))]}let re=[];if(typeof B>"u")return re;let W;if(r==="comma"&&Dd(B))w&&d&&(B=lO(B,d)),W=[{value:B.length>0?B.join(",")||null:void 0}];else if(Dd(f))W=f;else{let le=Object.keys(B);W=A?le.sort(A):le}let te=c?String(t).replace(/\./g,"%2E"):String(t),V=n&&Dd(B)&&B.length===1?te+"[]":te;if(a&&Dd(B)&&B.length===0)return V+"[]";for(let le=0;le<W.length;++le){let fe=W[le],Ve=typeof fe=="object"&&typeof fe.value<"u"?fe.value:B[fe];if(o&&Ve===null)continue;let xe=h&&c?fe.replace(/\./g,"%2E"):fe,At=Dd(B)?typeof r=="function"?r(V,xe):V:V+(h?"."+xe:"["+xe+"]");O.set(e,G);let Ce=new WeakMap;Ce.set(cO,O),Zne(re,eae(Ve,At,r,n,a,i,o,c,r==="comma"&&w&&Dd(B)?null:d,f,A,h,S,C,b,w,I,Ce))}return re}function bOe(e=Gi){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||Gi.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=o4;if(typeof e.format<"u"){if(!yOe.call(s4,e.format))throw new TypeError("Unknown format option provided.");r=e.format}let n=s4[r],a=Gi.filter;(typeof e.filter=="function"||Dd(e.filter))&&(a=e.filter);let i;if(e.arrayFormat&&e.arrayFormat in Jne?i=e.arrayFormat:"indices"in e?i=e.indices?"indices":"repeat":i=Gi.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:Gi.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Gi.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Gi.allowEmptyArrays,arrayFormat:i,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Gi.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?Gi.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Gi.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:Gi.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:Gi.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Gi.encodeValuesOnly,filter:a,format:r,formatter:n,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Gi.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Gi.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Gi.strictNullHandling}}function uO(e,t={}){let r=e,n=bOe(t),a,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Dd(n.filter)&&(i=n.filter,a=i);let o=[];if(typeof r!="object"||r===null)return"";let c=Jne[n.arrayFormat],d=c==="comma"&&n.commaRoundTrip;a||(a=Object.keys(r)),n.sort&&a.sort(n.sort);let f=new WeakMap;for(let S=0;S<a.length;++S){let C=a[S];n.skipNulls&&r[C]===null||Zne(o,eae(r[C],C,c,d,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,f))}let A=o.join(n.delimiter),h=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),A.length>0?h+A:""}m();m();var Og="4.95.1";m();m();m();var tae=!1,Bg,dO,TOe,IOe,wOe,pO,ROe,l4,fO,mO,gO,c4,_O;function rae(e,t={auto:!1}){if(tae)throw new Error(you must \import 'openai/shims/${e.kind}'\ before importing anything else from openai);if(Bg)throw new Error(can't \import 'openai/shims/${e.kind}'\ after \import 'openai/shims/${Bg}'\`);tae=t.auto,Bg=e.kind,dO=e.fetch,TOe=e.Request,IOe=e.Response,wOe=e.Headers,pO=e.FormData,ROe=e.Blob,l4=e.File,fO=e.ReadableStream,mO=e.getMultipartRequestOptions,gO=e.getDefaultAgent,c4=e.fileFromPath,_O=e.isFsReadStream}m();var Of=Ne(Gae(),1);m();m();uS();o7();import{inspect as j7e}from"util";m();q4();var foe=e=>e instanceof wd;z4();m();import{deprecate as K7e}from"util";var moe=K7e(()=>{},'Constructor "entries" argument is not spec-compliant and will be removed in next major release.');var Rd=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)},$4,Nd,s7,K4=class{constructor(t){$4.add(this),Nd.set(this,new Map),t&&(moe(),t.forEach(({name:r,value:n,fileName:a})=>this.append(r,n,a)))}static[(Nd=new WeakMap,$4=new WeakSet,Symbol.hasInstance)](t){return!!(t&&ci(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&ci(t.append)&&ci(t.set)&&ci(t.get)&&ci(t.getAll)&&ci(t.has)&&ci(t.delete)&&ci(t.entries)&&ci(t.values)&&ci(t.keys)&&ci(t[Symbol.iterator])&&ci(t.forEach))}append(t,r,n){Rd(this,$4,"m",s7).call(this,{name:t,fileName:n,append:!0,rawValue:r,argsLength:arguments.length})}set(t,r,n){Rd(this,$4,"m",s7).call(this,{name:t,fileName:n,append:!1,rawValue:r,argsLength:arguments.length})}get(t){let r=Rd(this,Nd,"f").get(String(t));return r?r[0]:null}getAll(t){let r=Rd(this,Nd,"f").get(String(t));return r?r.slice():[]}has(t){return Rd(this,Nd,"f").has(String(t))}delete(t){Rd(this,Nd,"f").delete(String(t))}*keys(){for(let t of Rd(this,Nd,"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}[(s7=function({name:r,rawValue:n,append:a,fileName:i,argsLength:o}){let c=a?"append":"set";if(o<2)throw new TypeError(Failed to execute '${c}' on 'FormData': 2 arguments required, but only ${o} present.);r=String(r);let d;if(i7(n))d=i===void 0?n:new fu([n],i,{type:n.type,lastModified:n.lastModified});else if(foe(n))d=new fu([n],i===void 0?"blob":i,{type:n.type});else{if(i)throw new TypeError(Failed to execute '${c}' on 'FormData': parameter 2 is not of type 'Blob'.);d=String(n)}let f=Rd(this,Nd,"f").get(r);if(!f)return void Rd(this,Nd,"f").set(r,[d]);if(!a)return void Rd(this,Nd,"f").set(r,[d]);f.push(d)},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"}[j7e.custom](){return this[Symbol.toStringTag]}};q4();uS();var D7=Ne(Toe(),1),ese=Ne(Qoe(),1);import{ReadStream as wBe}from"node:fs";m();m();m();var Uoe="abcdefghijklmnopqrstuvwxyz0123456789";function fBe(){let e=16,t="";for(;e--;)t+=Uoe[Math.random()*Uoe.length<<0];return t}var Goe=fBe;m();var mBe=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase();function gBe(e){if(mBe(e)!=="object")return!1;let t=Object.getPrototypeOf(e);return t==null?!0:(t.constructor&&t.constructor.toString())===Object.toString()}var h7=gBe;m();var _Be=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 hOe (file:///home/[user]/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:468:433)
at iO (file:///home/[user]/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:466:2281)
at $ne (file:///home/[user]/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:466:1418)
at dE.handleFunctionCall (file:///home/[user]/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:490:4648)
at dE.processEventsWithoutStreaming (file:///home/[user]/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:492:3562)
at dE.run (file:///home/[user]/.nvm/versions/node/v22.15.0/lib/node_modules/@openai/codex/dist/cli.js:491:3235)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)`

Hope this contribution helps! I normally get this about once a day, and it's inconsistent. It often occurs after I've loaded in a bunch of context for the model to understand before it gets to work, or it reads a particularly long sequence of code.

fezsid · 1 year ago
Yeah, I was running just fine earlier, got an update notice and took it, and now getting "Error: Sandbox was mandated, but no sandbox is available!" on latest. Windows with WSL Ubuntu 24.04.2 LTS. Hadn't had this problem since I started using Codex last week. Rolled back to v0.1.2504172351 and issue seems to have gone away

That worked for me. Thank you!
npm install -g @openai/codex@v0.1.2504172351

bluelighttechs · 1 year ago

Hey everyone, I ran into the same issue yesterday on a Linux system and spent most of the day troubleshooting it. After a lot of trial and error, here’s the solution that finally worked for me.

Root Cause
• Codex’s latest versions require a specific Docker-based sandbox with network isolation and filesystem access controls.
• It checks for the presence of /etc/codex/sandbox/enabled and requires a functional outbound connection to api.openai.com.
• Running Codex outside of a properly flagged container results in immediate failure.

Solution

Create a Docker Image with Proper Flags

A custom image was built based on node:22.15.0-slim, including:
• Codex CLI installation
• Sandbox flag file at /etc/codex/sandbox/enabled
• Required networking tools (curl, iptables)

Mount the Correct Host Directory

Docker was configured to mount "/home/my-project" into /workspace inside the container so Codex can access project files.

run_in_container.sh Script

A reusable script was created:

HOST_DIR="/home/"your-project"
CONTAINER_DIR="/workspace"
IMAGE_NAME="codex-sandbox"

if ! docker image inspect $IMAGE_NAME >/dev/null 2>&1; then
docker build -t $IMAGE_NAME - <<'EOF'
FROM node:22.15.0-slim
RUN apt-get update && apt-get install -y \
curl iptables ipset && \
npm install -g @openai/codex@0.1.2403191639 && \
mkdir -p /etc/codex/sandbox && \
touch /etc/codex/sandbox/enabled && \
apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
EOF
fi

docker run --rm -it \
--network=bridge \
-v "$HOST_DIR":"$CONTAINER_DIR" \
-w "$CONTAINER_DIR" \
$IMAGE_NAME

Make it executable:

chmod +x run_in_container.sh

Then run Codex:

./run_in_container.sh

Result

Codex now successfully launches inside a properly sandboxed Docker container. To ensure filesystem access worked as expected, we mounted the host directory directly from the absolute path (e.g., /home/your-folder-name) instead of relying on symbolic names or assumed working directories like /your-project.

This adjustment resolved the ENOENT errors caused by Codex attempting to recursively scan the filesystem. By explicitly mounting the correct host path into the container (-v /home/your-folder-name:/workspace), Codex is now able to access all required files and function as intended.

AnirudhaGohokar · 1 year ago

Still getting same error on windows:

Tried with latest codex : npm install -g @openai/codex@latest

nonlin · 1 year ago

Getting this on latest as well.

TheKurdishProgrammer · 11 months ago

I can confirm that, despite the latest update, the issue remains unresolved.

codex-maintainers · 11 months ago

Thanks for the feedback! Please try again on the latest version of Codex CLI. We're primarily focused on the native/Rust implementation of Codex CLI and would love to see if this is still an issue there.

AmazingTurtle · 11 months ago

I just downloaded codex and ran into this issue while using it for the very first time. Not 5 minutes ago.

whitebabylon · 11 months ago

just got this today too, same story as amazingturtle

whitebabylon · 11 months ago

edit moved to wsl 2 and run everything inside there now. it doesn't tell me it has no access anymore

edit** I'll keep the WSL stuff below as it's interesting, but Istill got the error again. I talked to chatgpt and it told me it was in a sandbox environment and couldn't help me. but it wasn't running in sandbox mode on windows. I told it it keeps opening wsl.exe and running stuff that closes immediately I couldn't see it. I asked it to run WSL.exe without closing on me. it told me it was sandboxed again and had no access to WSL.exe on my machine but it then ran again to look for the file it said it had no access to and it did keep WSL.exe open for me somehow. so it changed the commands it runs to interface on my machine? not clear. looking at the open WSL session it looked fine and had full access to everything. I told it it did have full access and to do the implementation for me, and it worked .

end edit****

turns out my WSL couldn't open, couldn't start, couldn't uninstall. my LX service also couldn't do anything, like I wasn't admin on my own machine. do at your own risk I suppose, but it seems like codex tries to open WSL command prompt windows and fail, and when that happens it says all sorts of stuff. Please don't mind me using GPT5 to summarize my past 2 hours fixing this issue.

🛠️ FIXED: How I Recovered from a Broken WSL (Error 0x80070424, 1603, Stuck Updates, etc.)

After WSL was completely broken (unable to list distros, install Ubuntu, or update via wsl --update), I resolved it by fully cleaning out the corrupted WSL install, then reinstalling cleanly using both a diagnostic tool and offline installer.

This post walks through every single step needed.

---

✅ TL;DR: What Worked for Me

  1. 🧼 Used Microsoft Install and Uninstall Troubleshooter to forcibly remove stuck WSL
  2. 🔧 Cleaned up all registry/files/features related to WSL
  3. 💾 Installed WSL manually via .msi
  4. 🐧 Installed Ubuntu via wsl --install -d Ubuntu
  5. 🐳 Reintegrated Docker with WSL (optional)

---

🔁 STEP-BY-STEP: WSL FULL RESET + REINSTALL

---

🧨 STEP 1 — Run Microsoft's Fix Tool to Remove Stuck WSL Install

  1. Download: MicrosoftProgram_Install_and_Uninstall.meta.diagcab
  2. Open it, choose "Uninstalling"
  3. Look for Windows Subsystem for Linux or anything related to WSL
  4. Let it forcibly uninstall it (this is the only tool that can fix 1603 / 0x80070424 MSI corruption)

---

🧼 STEP 2 — Run WSL Cleanup Script in PowerShell (Admin)

# Stop WSL
wsl --shutdown

# Unregister all distros
$distros = wsl -l | Select-String -NotMatch "NAME|----"
foreach ($d in $distros) {
    $name = $d.ToString().Trim()
    Write-Host "Unregistering: $name"
    wsl --unregister "$name"
}

# Disable features
dism.exe /online /disable-feature /featurename:Microsoft-Windows-Subsystem-Linux /norestart
dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /norestart
dism.exe /online /disable-feature /featurename:HypervisorPlatform /norestart

# Remove app packages
Get-AppxPackage *WindowsSubsystemLinux* | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage *CanonicalGroupLimited* | Remove-AppxPackage -ErrorAction SilentlyContinue

# Remove residual folders
Remove-Item "$env:LOCALAPPDATA\Packages\CanonicalGroupLimited*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:LOCALAPPDATA\Packages\MicrosoftCorporationII.WindowsSubsystemForLinux*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\AppData\Local\lxss" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\AppData\Local\Docker" -Recurse -Force -ErrorAction SilentlyContinue

# Optional: Repair system image
dism.exe /online /cleanup-image /restorehealth
sfc /scannow

Write-Host "`n✅ Cleanup complete. Please REBOOT now before reinstalling WSL." -ForegroundColor Green
### 🔄 STEP 3 — Reboot

You must reboot now to finalize cleanup.

---

### 💾 STEP 4 — Install WSL Manually via MSI

1. Go to: [https://github.com/microsoft/WSL/releases/latest](https://github.com/microsoft/WSL/releases/latest)
2. Download the latest `wsl-x.x.x.x.msi` (e.g. `wsl-2.5.10.0-x64.msi`)
3. Run it **as Administrator**
4. This will install the WSL backend + `LxssManager` cleanly

---

### 🐧 STEP 5 — Install a Linux Distro

#### Option A: Via Microsoft Store

➡️ [Ubuntu 22.04 LTS on Microsoft Store](https://www.microsoft.com/store/productId/9PN20MSR04DW)

#### Option B: CLI

```powershell
wsl --install -d Ubuntu
wsl --version
wsl -l -v
Tylersuard · 11 months ago

Why is this issue closed? It is still happening.

Showing cached comments. Read the full discussion on GitHub ↗