sipeed/picoclaw · error
failed to save credentials
Error message
failed to save credentials: %w
What it means
Context wrapper in authLoginOpenAI around auth.SetCredential: the OAuth login itself succeeded and produced a credential, but persisting it to the local auth store failed — typically an unwritable credentials file/path or a serialization problem. The token exists only in memory and is lost when this returns.
Solutions
- Check write permissions on the auth store path and its parent directory
- Ensure the store file is not locked or corrupted; remove and re-login if it is
- Verify disk space in the config directory
- Retry the login after fixing permissions — the flow will mint a fresh token and save it
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at cmd/picoclaw/internal/auth/helpers.go:54 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/6e2b0b14a3462545.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/picoclaw/internal/auth/helpers.go:54
func authLoginOpenAI(useDeviceCode bool, noBrowser bool) error {
cfg := auth.OpenAIOAuthConfig()
var cred *auth.AuthCredential
var err error
if useDeviceCode {
cred, err = auth.LoginDeviceCode(cfg)
} else {
cred, err = auth.LoginBrowserWithOptions(cfg, auth.LoginBrowserOptions{NoBrowser: noBrowser})
}
if err != nil {
return fmt.Errorf("login failed: %w", err)
}
if err = auth.SetCredential("openai", cred); err != nil {
return fmt.Errorf("failed to save credentials: %w", err)
}
appCfg, err := internal.LoadConfig()
if err == nil {
// Update or add openai in ModelList
foundOpenAI := false
for i := range appCfg.ModelList {
if isOpenAIModel(appCfg.ModelList[i]) {
appCfg.ModelList[i].AuthMethod = "oauth"
foundOpenAI = true
break
}
}
// If no openai in ModelList, add it
if !foundOpenAI {
appCfg.ModelList = append(appCfg.ModelList, &config.ModelConfig{
ModelName: "gpt-5.4",View on GitHub (pinned to 49183d7e8d)