Skip to content

Commit c17c1d7

Browse files
DreadPirateRobertzclaude
authored andcommitted
fix(convoy): route stranded scan warnings to stderr, not stdout (#2142)
findStrandedConvoys() used style.PrintWarning() which wrote to stdout, contaminating the JSON output when --json flag was set. The daemon's JSON parser failed on the warning text (U+26A0 prefix). Fix: use fmt.Fprintf(os.Stderr, ...) directly for the warning, ensuring stdout contains only valid JSON when --json is active. Also improve daemon error message to include raw stdout for debugging when JSON parsing fails. Closes #2142 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6e856d2 commit c17c1d7

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

internal/cmd/convoy.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,9 @@ func findStrandedConvoys(townBeads string) ([]strandedConvoyInfo, error) {
12671267
for _, convoy := range convoys {
12681268
tracked, err := getTrackedIssues(townBeads, convoy.ID)
12691269
if err != nil {
1270-
style.PrintWarning("skipping convoy %s: %v", convoy.ID, err)
1270+
// Write to stderr explicitly — stdout may be consumed as JSON
1271+
// by the daemon's JSON parser (fixes #2142).
1272+
fmt.Fprintf(os.Stderr, "⚠ Warning: skipping convoy %s: %v\n", convoy.ID, err)
12711273
continue
12721274
}
12731275
// Empty convoys (0 tracked issues) are stranded — they need

internal/daemon/convoy_manager.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,9 @@ func (m *ConvoyManager) findStranded() ([]strandedConvoyInfo, error) {
373373

374374
var stranded []strandedConvoyInfo
375375
if err := json.Unmarshal(stdout.Bytes(), &stranded); err != nil {
376-
return nil, fmt.Errorf("parsing stranded JSON: %w", err)
376+
// Include first line of raw output for debugging (e.g., non-JSON warnings on stdout)
377+
raw := util.FirstLine(stdout.String())
378+
return nil, fmt.Errorf("parsing stranded JSON: %w (raw: %q)", err, raw)
377379
}
378380

379381
return stranded, nil

0 commit comments

Comments
 (0)