Skip to content

[plan] Standardize error messages to use console.FormatErrorMessage() #11625

Closed

Description

@github-actions

Objective

Convert all user-facing error messages to use console.FormatErrorMessage() and ensure they go to stderr for consistency.

Context

From discussion #11611: Multiple CLI files use direct fmt.Printf for error messages instead of the standardized console formatting. This affects user experience and consistency.

Files with Issues: commands.go, git.go, file_tracker.go, run_workflow_tracking.go

Approach

  1. Audit each file for error message patterns:

    • Search for fmt.Printf with error-related text
    • Identify messages that should use console.FormatErrorMessage()
    • Ensure output goes to stderr
  2. Convert error messages:

    • Use fmt.Fprintln(os.Stderr, console.FormatErrorMessage(...))
    • Maintain clear, actionable error messages
    • Ensure proper error wrapping with %w
  3. Test changes:

    • Verify errors display correctly in terminal
    • Test non-TTY mode strips ANSI codes
    • Run existing tests to ensure no regressions

Files to Modify

  • Update: pkg/cli/commands.go
  • Update: pkg/cli/git.go
  • Update: pkg/cli/file_tracker.go
  • Update: pkg/cli/run_workflow_tracking.go

Pattern to Follow

// ❌ WRONG - Direct fmt.Printf without console formatting:
fmt.Printf("Error: Failed to process workflow: %v\n", err)

// ✅ CORRECT - Console formatted error to stderr:
fmt.Fprintln(os.Stderr, console.FormatErrorMessage(err.Error()))

// ✅ CORRECT - With context:
fmt.Fprintln(os.Stderr, console.FormatErrorMessage(fmt.Sprintf("Failed to process workflow: %v", err)))

Acceptance Criteria

  • All error messages in commands.go use console formatting
  • All error messages in git.go use console formatting
  • All error messages in file_tracker.go use console formatting
  • All error messages in run_workflow_tracking.go use console formatting
  • All error output goes to stderr
  • Existing tests pass
  • Code passes make fmt and make lint
  • make agent-finish completes successfully

Priority

Phase 2: Standardize Error Messages (4-6 hours estimated)

AI generated by Plan Command for discussion #11611

Activity

  1. github-actions commented on Jan 24, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster has assigned this to Copilot!

    I've identified this issue as a good candidate for automated resolution and assigned it to the Copilot agent.

    The Copilot agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    AI generated by Issue Monster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions