Skip to content

Route error and warning status messages to stderr so -o json output stays parseable#1673

Merged
dapr-bot merged 2 commits into
dapr:masterfrom
Mukuwul:fix/status-messages-stderr
Jul 20, 2026
Merged

Route error and warning status messages to stderr so -o json output stays parseable#1673
dapr-bot merged 2 commits into
dapr:masterfrom
Mukuwul:fix/status-messages-stderr

Conversation

@Mukuwul

@Mukuwul Mukuwul commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Description

dapr list -k -o json prints the namespace deprecation warning to stdout ahead of the JSON, so the output can't be parsed - the exact problem reported in #1015:

$ dapr list -k -o json | jq .
⚠  In future releases, this command will only query the "default" namespace by default. ...
[ ... ]      ← jq: parse error

Beyond that one warning, twelve FailureStatusEvent call sites across list, version, init, uninstall and the six workflow subcommands print errors to stdout, which both corrupts -o json/-o yaml output and hides errors from 2> redirection. Errors-to-stderr has been project policy since #748; these sites crept back in over time.

This PR routes all of them to stderr. The two remaining stdout sites in cmd/renew_certificate.go are intentionally left out - #1670 already moves them, and touching them here would just conflict.

No message text changes, so existing e2e assertions (which capture combined output) are unaffected; the invalid-output-format test asserts on the exit code, which is unchanged.

Issue reference

Fixes #1015

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests (existing e2e coverage exercises these paths via combined output and remains valid)
  • Extended the documentation (n/a — behavior fix)

Twelve call sites printed FailureStatusEvent to stdout, and dapr list -k
printed its namespace deprecation warning to stdout ahead of the
requested output, which corrupts 'dapr list -k -o json' (dapr#1015).
Errors-to-stderr is existing project policy (dapr#748); these sites crept
back in over time. The renew-certificate sites are intentionally left
out because dapr#1670 already moves them.

Fixes dapr#1015

Signed-off-by: Mukul <nmukul32@gmail.com>
@dapr-bot
dapr-bot merged commit fb6b835 into dapr:master Jul 20, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Commands print non-json warning when output set to json

3 participants