Pricing
Codex "turn/start failed in TUI": What It Means and How to Fix It
Codex CLI says "turn/start failed in TUI"? What the agent loop error means, the causes in OpenAI's GitHub issues (like a deleted cwd) and the fixes.
7 min read
Error strings quoted from OpenAI’s Codex GitHub issues #50930, #41559, #34937 and #33976 (verified Nov 3, 2026, re-checked Nov 4, 2026). Commands checked Nov 4, 2026 in OpenAI’s Codex CLI command reference (formerly developers.openai.com/codex/cli/reference). Every source is listed at the bottom. No affiliate links on this page (how we work).
The exact error: Failed to start turn: turn/start failed in TUI
The full line, from GitHub issue #50930 (verified Nov 3, 2026):
Failed to start turn: turn/start failed in TUI: turn/start failed: failed to submit turn input: internal error; agent loop died unexpectedly (code -32603)
The other common version, from #41559:
Failed to start turn: turn/start failed in TUI: turn/start failed: invalid cwd: No such file or directory (os error 2) (code -32600)
And the bare one, from the title of #33976: Error: turn/start failed in TUI.
The one-line answer: the Codex terminal UI couldn’t start a new turn, and the text after the last colon tells you why. “Invalid cwd” means the folder Codex was working in is gone. “Agent loop died unexpectedly” means the process handling your session crashed. The bare version doesn’t say. Either way, the session refuses every new message until you deal with it.
What causes it (per the GitHub issues)
Only what the reporters and OpenAI wrote. OpenAI hasn’t published a root cause for any of these as of Nov 4, 2026.
The working directory was deleted (#41559)
This is the cleanest case, and it’s a bit painful. In #41559 (opened Aug 29, 2026, codex-cli 0.151.0, Linux), the reporter ran a skill that set up a new project by deleting the current directory and recreating it. A folder with the same name came back, but it was a different directory on disk, so Codex’s working directory was gone. After that, every prompt returned the invalid cwd error.
Trying to escape with /cd failed too:
Cannot load AbsolutePathBuf("/path/supplied/to/cd"): Failed to rebuild config for cwd /path/supplied/to/cd
The reporter’s repro is three steps: make a folder, start Codex in it, ask Codex to delete the folder. It’s Michael Scott grilling his own foot on the George Foreman grill: Codex hurt itself with its own equipment. As of Nov 4, 2026, the issue is open, and an OpenAI team member has marked two other reports (#15926 and #36397) as duplicates of it. So it’s a known bug with no fix shipped yet.
“Agent loop died unexpectedly” (#50930, #34937)
#50930 (opened Oct 4, 2026, codex-cli 0.160.0, macOS) gave “Start codex” as the only repro step. The reporter later said “it is now working but it did happen.” An OpenAI team member closed it as not planned on Oct 10, 2026, saying “there’s not enough information for us to diagnose. If you see this again, please use /feedback to upload logs and post the session ID with your bug report.”
#34937 is the desktop app version (opened Jul 23, 2026, Windows 11). Its toast read Error creating chat / failed to start turn: internal error; agent loop died unexpectedly, then “Error submitting message” on every message until the app restarted. The reporter thinks it follows an interactive request that went unanswered for a while. A later commenter, not OpenAI staff, tied it to the built-in Browser tool and said “A full quit and relaunch is the only observed recovery.” We cover the app side in more detail in Codex error submitting message.
The bare “Error: turn/start failed in TUI” (#33976)
In #33976 (opened Jul 18, 2026, codex-cli 0.144.5, Linux, tmux), Codex exited while the reporter was sending a message to an existing session, with several Codex sessions running. Their wish: that crashes end with a codex resume message, so you don’t have to dig for the session ID. An OpenAI team member closed it as completed on Jul 21, 2026, with no comment and no fix version. It’s like the pit in Parks and Rec finally getting filled in with no announcement: good news, presumably, but you’d like to know when it happened and whether your version has it.
How to fix it, in order
Each step is marked with where it comes from.
- If the error says
invalid cwd: quit Codex,cdinto a folder that exists, and start again. This follows from #41559: the session’s folder is gone and/cdcan’t recover it, so you need a new process in a real directory. To pick up where you left off, runcodex resume. Per OpenAI’s CLI reference, if your current folder differs from the session’s saved one, “Codex asks which directory to use”, and an explicit--cd(-C) overrides that (verified Nov 4, 2026). Choose the folder that exists. - Update the CLI with
codex update. Per OpenAI’s CLI reference, it checks for and applies an update “when the installed release supports self-update”. If you installed via npm or Homebrew, OpenAI’s install page listsnpm install -g @openai/codexandbrew upgrade --cask codex(verified Nov 2, 2026). The issues above span versions 0.144.5 to 0.160.0, and #33976 was closed as completed, so you want a current build. - Restart, then use
codex resumeor/resumeinstead of fighting the broken session. Per the CLI reference,codex resumecontinues a session by ID or the most recent one,--lastis limited to the current folder unless you add--all, and/resumepicks a saved chat from inside the TUI. In the desktop app, #34937’s commenter reports a full quit and relaunch as the only recovery. - Don’t let Codex delete the folder it’s working in. It’s not an official rule, but #41559’s repro shows this is the trigger. If a skill or script recreates the project folder, run it from the parent directory.
- Check status.openai.com. If OpenAI has an incident, the agent loop isn’t your problem. (We link it; we don’t claim any live status here.)
- If it happens again, send
/feedbackand post the session ID. That’s what OpenAI asked for in #50930. Per the CLI reference,/feedbacksends logs to the Codex maintainers. Otherwise, as #50930 shows, the report gets closed for not having enough to go on.
What not to do: don’t delete ~/.codex or your session files to “reset” things unless you’re ready to lose your history. Nothing in these issues suggests it helps.
Which Codex error is this?
| Error | Where | Post |
|---|---|---|
| turn/start failed | CLI (TUI) | You’re here |
| Error submitting message | App, IDE | Submitting message |
| Error creating task | Cloud tasks | Creating task |
| Stream disconnected | Mid-response | Stream disconnected |
| stdin is not a terminal | Scripts, CI | stdin error |
If your problem is a cloud task timing out, read Codex error creating task. If the answer cut off halfway, it’s Codex stream disconnected. Running Codex from a script and getting stdin is not a terminal? See Codex stdin is not a terminal.
Does a failed turn use Codex credits?
Not published. OpenAI’s Codex help says starting a new chat doesn’t reset your usage limits (verified Nov 1, 2026), but nothing we found says whether a turn that never started counts. Check /status in the CLI if you want to see where your limits stand.
Here’s what I’d do
Read the end of the error line. invalid cwd: exit, cd somewhere real, codex resume, and pick the folder that exists. agent loop died unexpectedly: restart Codex, update it, resume the session, and if it comes back, send /feedback with the session ID so the report doesn’t get closed for lack of logs. Bare Error: turn/start failed in TUI: update first, since OpenAI marked that issue completed.
If Codex sessions keep dying mid-week, it’s fair to keep a second agent ready. Our Codex alternatives list and AI coding tools compared page have the options with dated prices.
Turn start failed vs can’t load the conversation history: for the load failure, see Codex Error Loading Messages.
FAQ
What does turn/start failed in TUI mean in Codex? The Codex terminal UI couldn’t start a new turn; the text after it says why, such as an invalid cwd (the folder was deleted) or a crashed agent loop.
How do I fix agent loop died unexpectedly in Codex? Restart Codex, update the CLI, and resume the session; if it happens again, OpenAI asks you to use /feedback and post the session ID.
How do I fix turn/start failed: invalid cwd: No such file or directory (os error 2)?
Codex’s working folder was deleted; quit, cd into a folder that exists, and run codex resume, because /cd can’t recover the session (GitHub issue #41559).
Does a failed turn use Codex credits? Not published; OpenAI doesn’t say whether a turn that failed to start counts toward Codex usage.
Is turn/start failed in TUI fixed? Partly; OpenAI closed #33976 as completed on Jul 21, 2026, but the deleted-folder bug in #41559 was still open as of Nov 4, 2026.
Sources
- OpenAI Codex GitHub issue #50930 (“agent loop died unexpectedly (code -32603)”; closed not planned Oct 10, 2026, with OpenAI’s /feedback request): https://github.com/openai/codex/issues/50930 (verified 2026-11-03, re-checked 2026-11-04)
- OpenAI Codex GitHub issue #41559 (invalid cwd after Codex deleted its working directory; open; #15926 and #36397 marked duplicates): https://github.com/openai/codex/issues/41559 (verified 2026-11-03, re-checked 2026-11-04)
- OpenAI Codex GitHub issue #34937 (desktop app “Error creating chat”, agent loop died; open): https://github.com/openai/codex/issues/34937 (verified 2026-11-03, re-checked 2026-11-04)
- OpenAI Codex GitHub issue #33976 (“Error: turn/start failed in TUI”; closed as completed Jul 21, 2026): https://github.com/openai/codex/issues/33976 (verified 2026-11-03, re-checked 2026-11-04)
- OpenAI Codex CLI command reference (codex resume, —last, —all, —cd, /resume, /cd, /feedback, codex update): https://learn.chatgpt.com/docs/developer-commands?surface=cli (verified 2026-11-04)
- OpenAI Codex CLI install page (npm and Homebrew update commands): https://developers.openai.com/codex/cli (verified 2026-11-02)
- Using Codex with your ChatGPT plan (new chat doesn’t reset limits, /status): https://help.openai.com/en/articles/11369540-using-codex-with-your-chatgpt-plan (verified 2026-11-01)
- OpenAI status page: https://status.openai.com (linked, no live status claimed)