Skip to content

Goal command hides underlying state DB errors #22942

Closed

Description

@nwparker

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 🐋

Activity

  1. added
    bugSomething isn't working
    CLIIssues related to the Codex CLI
    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal display
    app-serverIssues involving app server protocol or interfaces
    on May 16, 2026
  2. etraut-openai commented on May 16, 2026

    @etraut-openai
    Contributor

    The next version (0.131.0) will contain a check at launch for corrupt/malformed database and prevent this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displayapp-serverIssues involving app server protocol or interfacesbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions