Skip to content

feat: improve error messages with structured errors and suggestions#340

Open
aronchick wants to merge 1 commit intodlorenc:mainfrom
aronchick:work/fancy-bear
Open

feat: improve error messages with structured errors and suggestions#340
aronchick wants to merge 1 commit intodlorenc:mainfrom
aronchick:work/fancy-bear

Conversation

@aronchick
Copy link
Contributor

Summary

P0 Roadmap item: Clear error messages - Ensure every failure tells the user what went wrong and how to fix it.

  • Add 17 new error constructors to internal/errors for common failure modes
  • Update ~50 error handling locations in CLI to use structured errors with suggestions
  • Replace raw fmt.Errorf calls with CLIError that provides actionable guidance

Before/After Examples

Before:

Error: failed to register worker: connection refused 

After:

Error: failed to register worker with daemon: connection refused Try: multiclaude daemon status 

Before:

Error: repository 'myrepo' is already initialized Use 'multiclaude repo rm myrepo' to remove it first, or choose a different name 

After:

Configuration error: repository 'myrepo' is already initialized Try: multiclaude repo rm myrepo # to remove and re-init 

New Error Types

Error Constructor Use Case Suggestion
RepoAlreadyExists Repo init when already tracked multiclaude repo rm
DirectoryAlreadyExists Clone target exists Remove manually
WorkspaceAlreadyExists Workspace name taken multiclaude workspace list
InvalidWorkspaceName Bad workspace name Naming rules
LogFileNotFound Missing log file Agent may not have started
InvalidDuration Bad duration format Format examples
NoDefaultRepo Can't determine repo Use --repo or repo use
StateLoadFailed Corrupt state multiclaude repair
SessionIDGenerationFailed UUID failure Try again
PromptWriteFailed Can't write prompt Check disk/permissions
ClaudeStartFailed Claude won't start Check claude binary/tmux
AgentRegistrationFailed Daemon registration multiclaude daemon status
WorktreeCleanupNeeded Stale worktree git worktree remove
TmuxWindowCleanupNeeded Stale window tmux kill-window
TmuxSessionCleanupNeeded Stale session tmux kill-session
WorkerNotFound Worker doesn't exist multiclaude worker list
AgentNoSessionID Missing session ID Remove and recreate

Test plan

  • All internal package tests pass (go test ./internal/...)
  • All pkg tests pass (go test ./pkg/...)
  • Build succeeds (go build ./cmd/multiclaude)
  • Manual verification of error messages in common failure scenarios

🤖 Generated with Claude Code

P0 Roadmap item: Clear error messages This change ensures every user-facing error tells users: 1. What went wrong (clear, categorized message) 2. How to fix it (actionable suggestion) Changes: - Add 17 new error constructors to internal/errors for common failure modes - Update ~50 error handling locations in CLI to use structured errors - Replace raw fmt.Errorf calls with CLIError providing suggestions New error types added: - RepoAlreadyExists, DirectoryAlreadyExists, WorkspaceAlreadyExists - InvalidWorkspaceName, InvalidTmuxSessionName - LogFileNotFound, InvalidDuration, NoDefaultRepo - StateLoadFailed, SessionIDGenerationFailed, PromptWriteFailed - ClaudeStartFailed, AgentRegistrationFailed - WorktreeCleanupNeeded, TmuxWindowCleanupNeeded, TmuxSessionCleanupNeeded - WorkerNotFound, AgentNoSessionID Before: Error: failed to register worker: connection refused After: Error: failed to register worker with daemon: connection refused Try: multiclaude daemon status Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@aronchick
Copy link
Contributor Author

Merge Queue: READY TO MERGE

  • CI: All 6 checks passing
  • Merge status: MERGEABLE/CLEAN
  • Reviews: None blocking

This PR is ready for maintainer merge.

@aronchick aronchick marked this pull request as ready for review January 31, 2026 21:26
whitmo added a commit to whitmo/multiclaude that referenced this pull request Feb 28, 2026
whitmo added a commit to whitmo/multiclaude that referenced this pull request Feb 28, 2026
…nc#336, dlorenc#340, dlorenc#342 Add 659 lines of tests covering: - All 18 structured error constructors from PR dlorenc#340 (individual + bulk format test) - JSON CLI output edge cases from PR dlorenc#335 (empty/nested/all-internal subcommands) - Structured CLIError validation for workspace names from PR dlorenc#340 integration - Message routing edge cases from PR dlorenc#342 (no acked, mixed ack status) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
whitmo added a commit to whitmo/multiclaude that referenced this pull request Mar 1, 2026
Review of structured error constructors PR from upstream dlorenc/multiclaude. Identified duplicate constructor definitions with different signatures, minor category inconsistencies, and verbose string wrapping patterns. All critical issues already resolved in merge commit a03d3ea. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
whitmo added a commit to whitmo/multiclaude that referenced this pull request Mar 1, 2026
whitmo added a commit to whitmo/multiclaude that referenced this pull request Mar 1, 2026
…nc#336, dlorenc#340, dlorenc#342 Add 659 lines of tests covering: - All 18 structured error constructors from PR dlorenc#340 (individual + bulk format test) - JSON CLI output edge cases from PR dlorenc#335 (empty/nested/all-internal subcommands) - Structured CLIError validation for workspace names from PR dlorenc#340 integration - Message routing edge cases from PR dlorenc#342 (no acked, mixed ack status) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant