Setting a goal is not working with Failed to set thread goal: thread/goal/set failed in TUI
Resolved 💬 14 comments Opened May 1, 2026 by filip-minic Closed May 30, 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?
ChatGPT Pro Lite
Which model were you using?
gpt.5.5
What platform is your computer?
Darwin 25.4.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
Terminal.app
What issue are you seeing?
Trying to set a goal (which is somewhat detailed) results in the error message:
Failed to set thread goal: thread/goal/set failed in TUI
What steps can reproduce the bug?
Uploaded thread: 019de31e-1130-7262-939a-e8479075fb3a
What is the expected behavior?
_No response_
Additional information
_No response_
14 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I'm guessing that your state db (
~/.codex/state_5.sqlite) is corrupt. Try temporarily renaming it and restarting CLI. It should rebuild the db. By any chance, have you built Codex from source and/or run a fork at any point?Uploaded thread: 019decd7-22a6-7b91-b0c6-11838b69fb3f
Happens to me too. I deleted state_5.sqlite and sidecars, logs_2.sqlite-wal, logs_2.sqlite-shm.
Installed using brew.
same +1
Is this an issue with long text? [pasted content 10997 chats]
I guess it's long text related. I pasted around 8k text. When I put the same text in a file and set the goal to read that file, it worked.
Yes, goals are limited to 4000 characters. If you have a complex goal definition, you should write it to a file and refer to the file from the goal definition:
/goal implement the app described by app_spec.md.I'll add a better error message for cases where you exceed the 4000-character limit.
I am running into this issue as well.
Here is my current prompt:
/goal work exclusively within the current repo to implement the @goal.mdHere is the error:
■ Failed to read thread goal: thread/goal/get failed in TUII tried to delete instances of sqlite files in the ~/.codex directory but no success.
I ran into the same
/goalfailure and got it working with this workaround:~/.codex/config.toml:/goalstill fails withFailed to set thread goal: thread/goal/set failed in TUI, try setting a much shorter, single-line goal. In my case, long pasted objectives/specs seem to trigger the failure, while a concise goal works.Example:
So the practical workaround is: enable
features.goals, restart Codex, then keep the/goaltext short instead of pasting a full task brief.I am seeing the same Goal mode failure family in Codex Desktop on macOS.
Symptoms:
/goal/ composer UI path fails withFailed to set goal.Failed to clear goal.complete.Local config/runtime checks:
[features] goals = true.codex features listreportsgoals experimental true.codex --versionreportscodex-cli 0.133.0-alpha.1.Trace:
b7db443f-9070-4a60-8a1a-04df8a0e3139Related public signals I found while checking before posting:
thread/goal/setfailure family.thread/goal/getfailure family./goalslash-command failure family./goalfailures hiding DB/schema/process mismatch.This looks less like the feature flag being disabled and more like a UI/composer/progress-row state synchronization or thread-goal routing problem.
Addendum: performance trace uploaded from the Codex app.
Feedback ID:
b7db443f-9070-4a60-8a1a-04df8a0e3139This Feedback ID corresponds to the Goal mode UI set/clear failure described above:
/goalpath showedFailed to set goal.Failed to clear goal.status: complete.I am adding this comment to make explicit that the Feedback ID is from an uploaded Codex performance trace, not just a local tracker reference.
Follow-up after config repair and restart:
I found a local config-side problem that explains why Goal mode could appear unavailable or inconsistent across folders, and I repaired it locally.
Before repair, user-level Codex config had:
That means Auto-review was configured but approval prompts were disabled, so the Auto-review route could not actually be used for interactive approval requests. I changed it to:
After restart,
codex features listreportsgoals experimental truein both affected folders I checked. This repaired the local Goal enablement/config issue.What I learned from the official docs/Cookbook:
features.goals = truefeature flag when/goaldoes not appear or is not enabled.approval_policy = "on-request";approval_policy = "never"disables approval prompts.Remaining issue boundary:
If the visible app composer/progress-row still fails to set or clear a goal after this config repair and restart, then the remaining failure is no longer explained by local config. It should stay tracked as a Codex UI/thread-goal state issue in this thread/issue family.
Same uploaded performance trace reference:
Feedback ID:
b7db443f-9070-4a60-8a1a-04df8a0e3139Sources:
Additional public sibling to track with this Goal failure family: #24423.
#24423 reports Codex App Goal set and clear failures on Desktop, including
/goal clear, with local evidence pointing to older thread resume parsing before the goal operation. GitHub Actions linked #24423 to possible duplicates #24140 and #24282.This keeps the failure family connected without closing anything prematurely. The issue still appears unresolved unless maintainers identify a canonical duplicate, ship a fix, or provide a supported workaround.
This
/goalfeature is now enabled by default in the latest version of the app and the CLI. Some users were hitting the "failed to set thread goal" because they were running an older version of the Codex app or app server where the goals feature was not enabled.Some users were also hitting this because of a local db corruption. We've traced the problem to a bug in sqlite, and we've updated the version of sqlite that Codex is using. If you are still seeing
thread/goal/getfailures with the latest version of the app or CLI, that's the most likely cause. You can work around this by deletingCODEX_HOME/.codex/goals_1.sqlite*andCODEX_HOME/.codex/state_5.sqlite*and restarting codex. It will reconstruct these db files.