TUI trust prompt hides config/batchWrite failure cause when setting project trust

Open 💬 6 comments Opened May 29, 2026 by mahendra202602
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

codex-cli 0.135.0

What subscription do you have?

corporate

Which model were you using?

gpt-5.5

What platform is your computer?

Linux 5.15.0-316.196.4.1.el8uek.x86_64 x86_64 x86_64

What terminal emulator and version are you using (if applicable)?

macOS Terminal.app, SSH to Linux host

Codex doctor report

What issue are you seeing?

When starting Codex in an untrusted directory and selecting the option to
trust the directory, the TUI shows only:

Failed to set trust for <my_cwd_path>: config/batchWrite failed in TUI

This message is not actionable because it hides the underlying app-server/
config error. The failed operation is trying to persist project trust to the
user config, equivalent to:

[projects."<my_cwd_path>"]
trust_level = "trusted"

What steps can reproduce the bug?

  1. Start Codex in a directory that is not already trusted, for example:

cd <my_cwd_path>
codex

  1. At the TUI trust prompt, select the option to trust/continue.
  2. Observe the error:

Failed to set trust for <my_cwd_path>: config/batchWrite failed in TUI

What is the expected behavior?

The TUI should include the underlying config/batchWrite server error, for
example:

Failed to set trust for <my_cwd_path>: config/batchWrite failed in TUI:
<server-side cause>

or otherwise surface the JSON-RPC error message/data so the user can
distinguish readonly config, invalid config, app-server failure, and
validation failures.

Additional information

_No response_

View original on GitHub ↗

6 Comments

Pluviobyte · 3 months ago

Root cause: the underlying app-server error is preserved in the eyre cause chain, but the TUI renders it with {error} (outermost context only), so the real reason is dropped.

In codex-rs/tui/src/onboarding/onboarding_screen.rs (around L607–L618 on 56958f2), the same handler logs the full chain with {error:?} but shows the user only the outermost context via {error}:

Err(error) => {
    tracing::error!(
        "failed to persist trusted project state for {}: {error:?}",   // full chain -> logs
        trust_target.display()
    );
    if let Step::TrustDirectory(widget) = ... {
        widget.error = Some(format!(
            "Failed to set trust for {}: {error}",                       // top-level only -> user
            trust_target.display()
        ));
    }

The cause chain is real: write_trusted_project → write_config_batch in tui/src/config_update.rs ends with .wrap_err("config/batchWrite failed in TUI") (color_eyre WrapErr), so the Report's source is the actual JSON-RPC/app-server error (read-only config, invalid config, transport failure, etc.). format!("...: {error}") uses eyre's Display, which prints only the outermost context — hence the user sees config/batchWrite failed in TUI with the source dropped, while the log line two statements above ({error:?}) has the real reason.

Suggested fix (outline): render the chain with eyre's alternate Display — change {error} at L615 to {error:#} (single line, joins the full cause chain with : ), or {error:?} for the verbose form. No new dependency; {:#}/{:?} on eyre reports is already used across the codebase (including the tracing::error! immediately above). That surfaces the underlying reason the report is asking for.

Happy to put up a PR if a maintainer wants it

heyarny · 2 months ago

we are also getthing this error when trying to change models or anything that is located inside the config toml.
Did you find any workaround @Pluviobyte @mahendra202602 ?

heyarny · 2 months ago

Initial change error:

<img width="1461" height="211" alt="Image" src="https://github.com/user-attachments/assets/2da90398-897d-4085-9182-5c2a32d0cd41" />

This is what codex found out:

<img width="1313" height="277" alt="Image" src="https://github.com/user-attachments/assets/6641f248-e66d-4cf2-8ba2-d3232f6c969b" />

At the end of the day OpenAI should really think about providing a safe way to bind certain files/folders inside docker containers.
We are not allowed to bind root .codex folders as we break all other states and features codex provides (app-agent/daemon, sockets, ...) and we are not allowed to bind explicit files, as codex needs full access on folder level to them as well.
We are left with no options.

etraut-openai contributor · 23 days ago

We've decided to make all directories trusted by default unless you are using :read-only permissions. This makes the CLI (TUI) consistent with the desktop app's behavior. This will be included in the next release.

cedws · 3 days ago

Is the fix out for this? I'm on 0.149.1 now and still having it. In previous versions I was able to bypass the permission prompt with ^C but now this just causes it to exit, so I can't use Codex at all.

etraut-openai contributor · 2 days ago

After more discussion, we decided not to trust all directories by default. Reopening the issue.