summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-07-13 13:23:17 +0300
committerPaul Buetow <paul@buetow.org>2025-07-13 13:23:17 +0300
commit64ccb736a2ca134157af450dc5a300ab87db358d (patch)
treea619e3d6d83db25fdb7d4363dfead256f73464a0
parent330065de49075105ef78a171d219c416d4c7daf2 (diff)
fix: improve claude CLI error handling and diagnosticsv0.6.1
- Add detection for "Execution error" responses from claude CLI - Provide detailed error diagnostics when claude CLI fails - Show possible causes and remediation steps - Add test command to verify claude CLI functionality - Fix model names in error messages (opus, sonnet, haiku) - Remove hanging auth status check - Bump version to 0.6.1 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
-rw-r--r--TODO.md2
-rw-r--r--internal/release/release.go52
-rw-r--r--internal/version/version.go2
3 files changed, 52 insertions, 4 deletions
diff --git a/TODO.md b/TODO.md
index dcb1175..28650a5 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,4 +1,2 @@
# To-do's
-* in the project showcase table summary of a project add, that the project has mainly been vibe coded if the string 'vibe code' is found in the project README.md
-* in the "Overall Statistics" summary, add a count of projcets that have been vibe coded. the AI-Assist count of the projects should also include the vibe coded projects, clarify this in the overall statistics.
diff --git a/internal/release/release.go b/internal/release/release.go
index 6639d3d..e56e3cb 100644
--- a/internal/release/release.go
+++ b/internal/release/release.go
@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"net/http"
+ "os"
"os/exec"
"regexp"
"sort"
@@ -333,14 +334,36 @@ func (m *Manager) GenerateAIReleaseNotes(repoPath, repoName, tag string, allTags
fmt.Printf(" Prompt includes: %d commits, %.1fKB of code changes\n", len(commits), float64(len(diff))/1024)
fmt.Printf(" Total prompt length: %d characters\n", len(prompt.String()))
+ // Check if claude CLI is available
+ if _, err := exec.LookPath("claude"); err != nil {
+ return "", fmt.Errorf("claude CLI not found in PATH. Please ensure claude CLI is installed and available")
+ }
+
+ // Skip auth check - it may hang or cause issues
+ // Users can manually run 'claude auth status' if needed
+
cmd := exec.Command("claude", "--model", "sonnet", prompt.String())
+ cmd.Env = append(os.Environ(), "CLAUDE_DEBUG=1") // Enable debug mode if supported
output, err := cmd.CombinedOutput() // Use CombinedOutput to capture stderr
if err != nil {
// Check if it's an exit error and print the output
if exitErr, ok := err.(*exec.ExitError); ok {
fmt.Printf(" Claude CLI failed with exit code %d\n", exitErr.ExitCode())
fmt.Printf(" Error output: %s\n", string(output))
- return "", fmt.Errorf("claude CLI failed: %s", string(output))
+
+ // Provide more helpful error messages based on common issues
+ errorMsg := string(output)
+ fmt.Printf(" Raw error output: %q\n", errorMsg) // Show with quotes to see whitespace
+ if strings.Contains(errorMsg, "Execution error") && len(errorMsg) < 50 {
+ fmt.Println(" Hint: This generic error often indicates:")
+ fmt.Println(" - Authentication issues (try: claude auth login)")
+ fmt.Println(" - Network connectivity problems")
+ fmt.Println(" - Rate limiting")
+ fmt.Println(" - Invalid model name (valid: opus, sonnet, haiku)")
+ fmt.Println(" - Try running manually: claude --model sonnet \"Hello\"")
+ }
+
+ return "", fmt.Errorf("claude CLI failed: %s", errorMsg)
}
return "", fmt.Errorf("failed to run claude: %w", err)
}
@@ -350,6 +373,33 @@ func (m *Manager) GenerateAIReleaseNotes(repoPath, repoName, tag string, allTags
return "", fmt.Errorf("received empty release notes from claude")
}
+ // Check for known error messages in the output
+ if releaseNotes == "Execution error" || strings.HasPrefix(releaseNotes, "Error:") {
+ // Try to provide more context about the error
+ fmt.Println(" Claude CLI error details:")
+ fmt.Printf(" - Output: %s\n", releaseNotes)
+ fmt.Printf(" - Prompt length: %d characters\n", len(prompt.String()))
+ fmt.Println(" - Possible causes:")
+ fmt.Println(" 1. Authentication issue - try: claude auth login")
+ fmt.Println(" 2. Rate limiting - wait a few minutes")
+ fmt.Println(" 3. Network connectivity issue")
+ fmt.Println(" 4. Prompt too long (max ~200k tokens)")
+ fmt.Println(" 5. Invalid model name (valid: opus, sonnet, haiku)")
+
+ // Try running a simple test command to diagnose
+ testCmd := exec.Command("claude", "--model", "sonnet", "Say 'test'")
+ if testOutput, testErr := testCmd.CombinedOutput(); testErr != nil {
+ fmt.Printf(" - Test command failed: %v\n", testErr)
+ if len(testOutput) > 0 {
+ fmt.Printf(" - Test output: %s\n", strings.TrimSpace(string(testOutput)))
+ }
+ } else {
+ fmt.Printf(" - Test command succeeded: %s\n", strings.TrimSpace(string(testOutput)))
+ }
+
+ return "", fmt.Errorf("claude CLI returned an error: %s", releaseNotes)
+ }
+
// Add header
var finalNotes strings.Builder
finalNotes.WriteString(fmt.Sprintf("# Release %s\n\n", tag))
diff --git a/internal/version/version.go b/internal/version/version.go
index 5dcb8fb..636bf04 100644
--- a/internal/version/version.go
+++ b/internal/version/version.go
@@ -7,7 +7,7 @@ import (
var (
// Version is the current version of gitsyncer
- Version = "0.6.0"
+ Version = "0.6.1"
// GitCommit is the git commit hash at build time
GitCommit = "unknown"