codex - 💡(How to fix) Fix Goal command hides underlying state DB errors

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When /goal fails in the TUI, the user-visible error can collapse to only:

Failed to set thread goal: thread/goal/set failed in TUI

In one reproduced case on codex-cli 0.130.0, the underlying app-server error was actually SQLite state corruption:

error returned from database: (code: 11) database disk image is malformed

That root cause was not visible from the TUI message, which made the failure look like a generic goal-mode bug.

Error Message

When /goal fails in the TUI, the user-visible error can collapse to only: In one reproduced case on codex-cli 0.130.0, the underlying app-server error was actually SQLite state corruption: error returned from database: (code: 11) database disk image is malformed The TUI should include the underlying app-server/source-chain error, so a user can distinguish corrupt local state from a generic goal command failure. This is related to #20598, but this issue captures a concrete root cause and verified workaround for one instance of the same visible TUI error.

Root Cause

That root cause was not visible from the TUI message, which made the failure look like a generic goal-mode bug.

Fix Action

Fix / Workaround

Verified workaround

This is related to #20598, but this issue captures a concrete root cause and verified workaround for one instance of the same visible TUI error.

Code Example

Failed to set thread goal: thread/goal/set failed in TUI

---

error returned from database: (code: 11) database disk image is malformed

---

thread/goal/set -> database disk image is malformed

---

sqlite3 ~/.codex/state_5.sqlite 'PRAGMA integrity_check;'

---

~/.codex/state_5.sqlite
~/.codex/state_5.sqlite-shm
~/.codex/state_5.sqlite-wal
RAW_BUFFERClick to expand / collapse

Summary

When /goal fails in the TUI, the user-visible error can collapse to only:

Failed to set thread goal: thread/goal/set failed in TUI

In one reproduced case on codex-cli 0.130.0, the underlying app-server error was actually SQLite state corruption:

error returned from database: (code: 11) database disk image is malformed

That root cause was not visible from the TUI message, which made the failure look like a generic goal-mode bug.

Reproduction / diagnosis

Directly calling the app-server method against the affected Codex home produced:

thread/goal/set -> database disk image is malformed

The local state DB also failed integrity checks:

sqlite3 ~/.codex/state_5.sqlite 'PRAGMA integrity_check;'

with SQLite code 11 / malformed database output.

Verified workaround

After quitting Codex, moving these files aside fixed the local /goal failure:

~/.codex/state_5.sqlite
~/.codex/state_5.sqlite-shm
~/.codex/state_5.sqlite-wal

On restart, Codex recreated state_5.sqlite, backfilled from existing rollout sessions, and thread/goal/set, thread/goal/get, and thread/goal/clear all succeeded. A fresh PRAGMA integrity_check returned ok.

Expected behavior

The TUI should include the underlying app-server/source-chain error, so a user can distinguish corrupt local state from a generic goal command failure.

Related

This is related to #20598, but this issue captures a concrete root cause and verified workaround for one instance of the same visible TUI error.

Made with Orca 🐋

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The TUI should include the underlying app-server/source-chain error, so a user can distinguish corrupt local state from a generic goal command failure.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING