sipeed/picoclaw · error

failed to remove credentials

Error message

failed to remove credentials: %w

What it means

Context wrapper in authLogoutCmd around auth.DeleteCredential: the user asked to log out of a named provider, but deleting its entry from the persisted auth store failed — usually an unreadable/corrupt store file or a write permission problem. The credential may still be present, so logout did not take effect.

Solutions

  1. Check permissions on the auth store file and its directory
  2. Inspect the wrapped error for corruption; recreate the store if needed
  3. Verify the store file is not locked by a concurrent picoclaw process
  4. Retry logout after fixing the file
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cmd/picoclaw/internal/auth/helpers.go:336 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/268b27b060b528cc. Report an issue: GitHub.

Appendix: source

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

		}
		if err := config.SaveConfig(internal.GetConfigPath(), appCfg); err != nil {
			return fmt.Errorf("could not update config: %w", err)
		}
	}

	fmt.Printf("Token saved for %s!\n", provider)

	if appCfg != nil {
		fmt.Printf("Default model set to: %s\n", appCfg.Agents.Defaults.GetModelName())
	}

	return nil
}

func authLogoutCmd(provider string) error {
	if provider != "" {
		if err := auth.DeleteCredential(provider); err != nil {
			return fmt.Errorf("failed to remove credentials: %w", err)
		}

		appCfg, err := internal.LoadConfig()
		if err == nil {
			// Clear AuthMethod in ModelList
			for i := range appCfg.ModelList {
				switch provider {
				case "openai":
					if isOpenAIModel(appCfg.ModelList[i]) {
						appCfg.ModelList[i].AuthMethod = ""
					}
				case "anthropic":
					if isAnthropicModel(appCfg.ModelList[i]) {
						appCfg.ModelList[i].AuthMethod = ""
					}
				case "google-antigravity", "antigravity":
					if isAntigravityModel(appCfg.ModelList[i]) {
						appCfg.ModelList[i].AuthMethod = ""

View on GitHub (pinned to 49183d7e8d)