plandex-ai/plandex · error

error verifying email: %v

Error message

error verifying email: %v

What it means

RefreshInvalidToken calls verifyEmail(Current.Email, Current.Host) to check the account exists and get a PIN for re-authentication. Any failure from that call (network error, server error, malformed response) is wrapped as this error.

Source

Thrown at app/cli/auth/auth.go:97

		Current.OrgName = org.Name
		Current.IntegratedModelsMode = org.IntegratedModelsMode

		err = writeCurrentAuth()

		if err != nil {
			term.OutputErrorAndExit("Error writing auth: %v", err)
		}
	}
}

func RefreshInvalidToken() error {
	if Current == nil {
		return fmt.Errorf("error refreshing token: auth not loaded")
	}
	res, err := verifyEmail(Current.Email, Current.Host)

	if err != nil {
		return fmt.Errorf("error verifying email: %v", err)
	}

	if res.hasAccount {
		return signIn(Current.Email, res.pin, Current.Host)
	} else {
		host := Current.Host
		if host == "" {
			host = "Plandex Cloud"
		}

		term.OutputErrorAndExit("Account %s not found on %s", Current.Email, host)
	}

	return nil
}

func RefreshAuth() error {
	if Current == nil {

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check network connectivity to the configured host (or Plandex Cloud)
  2. Verify the host URL in auth.json is correct and the server is up (curl the health endpoint)
  3. Run `plandex sign in` fresh to re-establish email/host and a new token
  4. If self-hosted, confirm the server version matches the CLI and is reachable

Example fix

// before
host := "http://old-server.internal:8080" // unreachable
// after
curl -s http://new-server.internal:8080/health && plandex sign in --host http://new-server.internal:8080
Defensive patterns

Strategy: retry

Validate before calling

if auth.Current == nil || auth.Current.Email == "" {
	return fmt.Errorf("no stored email to verify; run `plandex sign in`")
}
// preflight: can we reach the host?
resp, err := http.Get(hostBaseURL + "/health")
if err != nil || resp.StatusCode != 200 {
	return fmt.Errorf("server unreachable; refresh would fail")
}

Type guard

func refreshPossible() bool { return auth.Current != nil && auth.Current.Email != "" && auth.Current.Host != "" }

Try / catch

if err := auth.RefreshInvalidToken(); err != nil {
	if strings.Contains(err.Error(), "verifying email") {
		// transient network/server issue: back off and retry
		time.Sleep(2 * time.Second)
		err = auth.RefreshInvalidToken()
	}
	if err != nil { term.OutputErrorAndExit("%v", err) }
}

Prevention

When it happens

Trigger: verifyEmail fails because the server is unreachable, returns a non-2xx/ApiError, the host is misconfigured, or Current.Email/Host are empty or stale.

Common situations: Offline or behind a proxy/VPN blocking the Plandex server; self-hosted server down or DNS misconfigured; token expired long ago and the stored host URL changed (e.g. after migrating a self-hosted instance); account deleted server-side.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/4487f46cccc75f0c. Report an issue: GitHub.