Failed to read thread goal: thread/goal/get failed in TUI
Resolved 💬 15 comments Opened May 3, 2026 by txtttx Closed May 16, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of Codex CLI is running?
codex-cli 0.128.0
What subscription do you have?
pro 5x
Which model were you using?
gpt-5.5
What platform is your computer?
Darwin 25.1.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
cursor
What issue are you seeing?
■ Failed to read thread goal: thread/goal/get failed in TUI
What steps can reproduce the bug?
Uploaded thread: 019debd9-2372-7f23-92b9-9f34002a6355
What is the expected behavior?
_No response_
Additional information
_No response_
15 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
@etraut-openai Thanks for the suggestion. I tried to move state_5.sqlite to state_5.sqlite_backup and let it rebuild. But it doesn't help
OK, thanks for trying. I'm investigating your logs (thanks for uploading!) and that's hinting at a problem with the
logs_2.sqlitefile.Thanks for the suggestion. I moved logs_2.sqlite to backup. Codex can start up much faster, but I still hit the TUI bug.
New thread ID: 019debf3-7108-78c1-97af-8b3dfdb48951
Did you move all of the
logs_2files including the logs_2.sqlite-wal and logs_2.sqlite-shm sidecars? The latest log you uploaded hints at having inconsistent db state. Try moving all of those files to backup.Thanks it resolved the issue. For whoever hit this problem, I moved logs_2.sqlite and state_5.sqlite to backup folders.
Additional 0.130.0 Linux signal
Confirming the same failure still occurs on Linux with
codex-cli 0.130.0andgoals experimental true.The useful reproducer was:
That exposed the underlying init failure:
Local isolation:
state_5.sqlite*did not clear the migration error.logs_2.sqlite*too cleared the state runtime failure.backfill_state.status = completethreadsPRAGMA integrity_checkreturnedokfor the recreated state and logs DBsFailure mapping:
I do not see the exact
app-serverinit signal above, so adding it here. The confusing part is thatthe TUI points at
thread/goal/get, while the actionable failure is state runtime initialization. Inthis case, the blocking DB was
logs_2.sqlite*, not onlystate_5.sqlite*.Suggested product-side fix: surface the state-runtime migration error in the TUI, include the failing
DB name, and document recovery for both
state_5.sqlite*andlogs_2.sqlite*, including-waland-shmsidecars.The next version (0.131.0) addresses this issue by detecting sqlite corruption and lock contention at launch time rather than allowing these conditions to appear later (e.g. when creating a goal).
Just adding that I encountered this issue, but it was caused by multiple Codex processes running and not fully closed. After I closed the other processes, the issue went away.
@rmcc3, thanks for the tip. Yes, the next version will detect this situation and recommend that you close other copies.
even with the latest version (codex-cli 0.130.0) I have the same issue. (Failed to read thread goal: thread/goal/get failed in TUI)
I just ran into this issue so am here too. In #20591, etraut-openai suggests moving
~/.codex/state_5.sqliteand restarting. Worked for me. He said that 0.131.0 will fix this issue. They just haven't released the next update yet. The other possible issue is if you have a long/goalprompt, to put it in a file and just tell it to do what's in the file.Version 0.132.0 has a similar issue.
I fixed this issue by asking Codex to find problem in logs. Codex found in logs_2.sqlite that goals feature is disabled and executed by adding goals = true into config.toml. now everything works fine
同时安装了codex cli 与 codex app 导致的,我让codex 自己成功修复并找出原因
Failed to read thread goal: thread/goal/get failed in TUI
底层日志是:
no such table: thread_goals
所以不是 cad_viewer 项目代码导致的,也不是 SQLite 损坏。根因是 新旧 Codex 同时使用同一份用户数据目录,但它们对 goal 表的位置预期不同。
另外日志里那些 401/403、token invalidated、插件列表加载失败,不是 /goal 失败的直接原因。直接原因就是 state_5.sqlite 里旧版 TUI 要读的 thread_goals 表被新版本迁移删除了。