Merge pull request #1058 from danfinn5/fix/cloud-mode-error-messages

fix(cli): surface actionable errors for cloud-mode setup failures
This commit is contained in:
xarmian
2026-08-06 01:01:56 -04:00
committed by GitHub
3 changed files with 13 additions and 2 deletions
+7 -2
View File
@@ -691,11 +691,16 @@ func saveCredentials(cfg *config.Config, resp *cli.LoginResponse) error {
}
func printSetupRequiredHint(cfg *config.Config) {
fmt.Println("This Pad instance has not been initialized yet.")
switch cfg.Mode {
case config.ModeRemote, config.ModeCloud:
case config.ModeCloud:
fmt.Println("You're configured in Cloud mode but don't have an account on Pad Cloud yet.")
fmt.Printf(" Sign up at %s/register, then run 'pad auth login'.\n", config.CloudBaseURL)
fmt.Println(" Or switch to a local server with 'pad auth configure --mode local'.")
case config.ModeRemote:
fmt.Println("This Pad instance has not been initialized yet.")
fmt.Println("Run 'pad auth setup' on the machine or container running the Pad server, then try again.")
default:
fmt.Println("This Pad instance has not been initialized yet.")
fmt.Println("Run 'pad auth setup' to create the first admin account, then try again.")
}
}
+3
View File
@@ -198,6 +198,9 @@ Examples:
// --cli-prompt requires a TTY there too. Use --email/--name/
// --password to bootstrap a remote instance non-interactively.
printSetupRequiredHint(cfg)
if cfg.Mode == config.ModeCloud {
return fmt.Errorf("Pad Cloud account required")
}
return fmt.Errorf("this Pad instance has not been initialized yet")
} else if !canPromptForConfig() {
printSetupRequiredHint(cfg)
+3
View File
@@ -1612,6 +1612,9 @@ func parseErrorBody(status int, body []byte) error {
Error APIError `json:"error"`
}
if err := json.Unmarshal(body, &errResp); err == nil && errResp.Error.Message != "" {
if errResp.Error.Code == "csrf_error" {
errResp.Error.Message = "Session authentication error. Run 'pad auth login' to re-authenticate."
}
return &errResp.Error
}
return fmt.Errorf("API error: %d %s", status, string(body))