Skip to content

[CLI] Write logs, errors and warnings to stderr - #4405

Merged
un-def merged 1 commit into
masterfrom
issue_4403_cli_diagnostics_to_stderr
Oct 23, 2026
Merged

un-def merged 1 commit into
masterfrom
issue_4403_cli_diagnostics_to_stderr

Conversation

@un-def

@un-def un-def commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

stdout should carry only command output so that --json stays parseable. Logging, fatal errors from main(), warn(), the update notice, get "not found" errors, and preset mirroring warnings now go to stderr.

error_console resolves sys.stderr on each write. A plain Console(stderr=True) unwraps the proxy that rich.live.Live installs, so its output would garble an active spinner or live table. While Live is active, error_console also reports no fileno. Otherwise, on consoles without VT support, rich writes and flushes each styled segment separately, and the proxy prints each one on a separate line.

Fixes: #4403

stdout should carry only command output so that `--json` stays
parseable. Logging, fatal errors from `main()`, `warn()`, the update
notice, `get` "not found" errors, and preset mirroring warnings now
go to stderr.

`error_console` resolves `sys.stderr` on each write. A plain
`Console(stderr=True)` unwraps the proxy that `rich.live.Live`
installs, so its output would garble an active spinner or live table.
While `Live` is active, `error_console` also reports no fileno.
Otherwise, on consoles without VT support, rich writes and flushes
each styled segment separately, and the proxy prints each one on a
separate line.

Fixes: #4403
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@un-def un-def changed the title Write CLI logs, errors and warnings to stderr [CLI] Write logs, errors and warnings to stderr Oct 23, 2026
@un-def
un-def merged commit 0f6db9d into master Oct 23, 2026
29 checks passed
@un-def
un-def deleted the issue_4403_cli_diagnostics_to_stderr branch October 23, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CLI writes logs, errors and warnings to stdout, breaking --json output

1 participant