{"record":{"id":"6e2b0b14a3462545","repo":"sipeed/picoclaw","slug":"failed-to-save-credentials-w","errorCode":null,"errorMessage":"failed to save credentials: %w","messagePattern":"failed to save credentials: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/picoclaw/internal/auth/helpers.go","lineNumber":54,"sourceCode":"\nfunc authLoginOpenAI(useDeviceCode bool, noBrowser bool) error {\n\tcfg := auth.OpenAIOAuthConfig()\n\n\tvar cred *auth.AuthCredential\n\tvar err error\n\n\tif useDeviceCode {\n\t\tcred, err = auth.LoginDeviceCode(cfg)\n\t} else {\n\t\tcred, err = auth.LoginBrowserWithOptions(cfg, auth.LoginBrowserOptions{NoBrowser: noBrowser})\n\t}\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"login failed: %w\", err)\n\t}\n\n\tif err = auth.SetCredential(\"openai\", cred); err != nil {\n\t\treturn fmt.Errorf(\"failed to save credentials: %w\", err)\n\t}\n\n\tappCfg, err := internal.LoadConfig()\n\tif err == nil {\n\t\t// Update or add openai in ModelList\n\t\tfoundOpenAI := false\n\t\tfor i := range appCfg.ModelList {\n\t\t\tif isOpenAIModel(appCfg.ModelList[i]) {\n\t\t\t\tappCfg.ModelList[i].AuthMethod = \"oauth\"\n\t\t\t\tfoundOpenAI = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// If no openai in ModelList, add it\n\t\tif !foundOpenAI {\n\t\t\tappCfg.ModelList = append(appCfg.ModelList, &config.ModelConfig{\n\t\t\t\tModelName:  \"gpt-5.4\",","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/picoclaw/internal/auth/helpers.go#L36-L72","documentation":"Error \"failed to save credentials: %w\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at cmd/picoclaw/internal/auth/helpers.go:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}