fix: suggest 'picoclaw doctor' in error messages across CLI

Fixes #577: config load failures, provider creation errors, and gateway
startup errors now hint at running 'picoclaw doctor'. Onboarding success
message includes troubleshooting section. Help text updated.
This commit is contained in:
Rahul Bansal 2026-02-21 10:28:20 +05:30
parent 67bbf6f7f4
commit 11e001b27c
5 changed files with 11 additions and 1 deletions

View file

@ -29,6 +29,7 @@ func cronCmd() {
cfg, err := loadConfig() cfg, err := loadConfig()
if err != nil { if err != nil {
fmt.Printf("Error loading config: %v\n", err) fmt.Printf("Error loading config: %v\n", err)
fmt.Println("Run 'picoclaw doctor' to check for common problems.")
return return
} }

View file

@ -50,12 +50,14 @@ func gatewayCmd() {
cfg, err := loadConfig() cfg, err := loadConfig()
if err != nil { if err != nil {
fmt.Printf("Error loading config: %v\n", err) fmt.Printf("Error loading config: %v\n", err)
fmt.Println("Run 'picoclaw doctor' to check for common problems.")
os.Exit(1) os.Exit(1)
} }
provider, modelID, err := providers.CreateProvider(cfg) provider, modelID, err := providers.CreateProvider(cfg)
if err != nil { if err != nil {
fmt.Printf("Error creating provider: %v\n", err) fmt.Printf("Error creating provider: %v\n", err)
fmt.Println("Run 'picoclaw doctor' to check for common problems.")
os.Exit(1) os.Exit(1)
} }
// Use the resolved model ID from provider creation // Use the resolved model ID from provider creation
@ -123,6 +125,7 @@ func gatewayCmd() {
channelManager, err := channels.NewManager(cfg, msgBus) channelManager, err := channels.NewManager(cfg, msgBus)
if err != nil { if err != nil {
fmt.Printf("Error creating channel manager: %v\n", err) fmt.Printf("Error creating channel manager: %v\n", err)
fmt.Println("Run 'picoclaw doctor' to check for common problems.")
os.Exit(1) os.Exit(1)
} }

View file

@ -64,6 +64,10 @@ func onboard() {
fmt.Println(" See README.md for 17+ supported providers.") fmt.Println(" See README.md for 17+ supported providers.")
fmt.Println("") fmt.Println("")
fmt.Println(" 2. Chat: picoclaw agent -m \"Hello!\"") fmt.Println(" 2. Chat: picoclaw agent -m \"Hello!\"")
fmt.Println("")
fmt.Println("If something isn't working:")
fmt.Println(" picoclaw doctor Check for common problems")
fmt.Println(" picoclaw doctor --fix Auto-fix what it can")
} }
func copyEmbeddedToTarget(targetDir string) error { func copyEmbeddedToTarget(targetDir string) error {

View file

@ -27,6 +27,7 @@ func statusCmd() {
cfg, err := loadConfig() cfg, err := loadConfig()
if err != nil { if err != nil {
fmt.Printf("Error loading config: %v\n", err) fmt.Printf("Error loading config: %v\n", err)
fmt.Println("Run 'picoclaw doctor' to check for common problems.")
return return
} }

View file

@ -133,6 +133,7 @@ func main() {
cfg, err := loadConfig() cfg, err := loadConfig()
if err != nil { if err != nil {
fmt.Printf("Error loading config: %v\n", err) fmt.Printf("Error loading config: %v\n", err)
fmt.Println("Run 'picoclaw doctor' to check for common problems.")
os.Exit(1) os.Exit(1)
} }
@ -195,7 +196,7 @@ func printHelp() {
fmt.Println(" cron Manage scheduled tasks") fmt.Println(" cron Manage scheduled tasks")
fmt.Println(" migrate Migrate from OpenClaw to PicoClaw") fmt.Println(" migrate Migrate from OpenClaw to PicoClaw")
fmt.Println(" skills Manage skills (install, list, remove)") fmt.Println(" skills Manage skills (install, list, remove)")
fmt.Println(" doctor Check for common problems (--fix to auto-repair)") fmt.Println(" doctor Diagnose and fix common problems (--fix to auto-repair)")
fmt.Println(" version Show version information") fmt.Println(" version Show version information")
} }