Print a failed command's error once on stderr (closes #433)
check / check (push) Successful in 9m25s

A command that failed after startup wrote the error twice on stderr:
as an ERROR log record and as the final ERROR: line. The failure
handlers now log the failure at info level, so the record appears only
under --verbose or --debug, next to the records that led up to it.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-11 02:14:06 +00:00
1 parent 098ed80990
commit f120acd2c7
8 files changed
+115 -9

No files matched your search

+4
View File
@@ -82,6 +82,10 @@ func emitStartupBanner(args []string, w io.Writer) {
// 🛑 ERROR: format. Use it from goroutine error paths (where returning
// an error to cobra isn't an option) and anywhere else a CLI command
// must surface a failure outside the normal RunE return path.
//
// This line is the one report of the failure. A caller that also logs
// the failure logs it at info level, so the record appears only under
// --verbose or --debug and the error is not printed twice.
func ReportErrorf(format string, args ...any) {
ui.New(os.Stderr).Errorf(format, args...)
}