sipeed/picoclaw · error

failed to load auth store

Error message

failed to load auth store: %w

What it means

Context wrapper in authStatusCmd around auth.LoadStore: the persisted credentials store cannot be loaded at all, so auth status cannot be reported. Typically the store file is missing in an unexpected state, unreadable, or fails to deserialize; distinct from the 'no credentials' case, which is reported as a normal empty state.

Solutions

  1. Inspect the wrapped error to distinguish missing-file from parse errors
  2. Restore or recreate the auth store file with correct permissions
  3. Log in again to rebuild the store if it is corrupt
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cmd/picoclaw/internal/auth/helpers.go:387 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/05174d4b7c1ad820. Report an issue: GitHub.

Appendix: source

Thrown at cmd/picoclaw/internal/auth/helpers.go:387

	appCfg, err := internal.LoadConfig()
	if err == nil {
		// Clear all AuthMethods in ModelList
		for i := range appCfg.ModelList {
			appCfg.ModelList[i].AuthMethod = ""
		}
		config.SaveConfig(internal.GetConfigPath(), appCfg)
	}

	fmt.Println("Logged out from all providers")

	return nil
}

func authStatusCmd() error {
	store, err := auth.LoadStore()
	if err != nil {
		return fmt.Errorf("failed to load auth store: %w", err)
	}

	if len(store.Credentials) == 0 {
		fmt.Println("No authenticated providers.")
		fmt.Println("Run: picoclaw auth login --provider <name>")
		return nil
	}

	fmt.Println("\nAuthenticated Providers:")
	fmt.Println("------------------------")
	for provider, cred := range store.Credentials {
		status := "active"
		if cred.IsExpired() {
			status = "expired"
		} else if cred.NeedsRefresh() {
			status = "needs refresh"
		}

View on GitHub (pinned to 49183d7e8d)