{"record":{"id":"d8e0e837bab38f1b","repo":"plandex-ai/plandex","slug":"error-setting-auth-v","errorCode":null,"errorMessage":"error setting auth: %v","messagePattern":"error setting auth: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/auth/account.go","lineNumber":94,"sourceCode":"\t\treturn fmt.Errorf(\"error listing orgs: %v\", apiErr.Msg)\n\t}\n\n\torg, err := resolveOrgAuth(orgs, selectedAuth.IsLocalMode)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error resolving org: %v\", err)\n\t}\n\n\terr = setAuth(&shared.ClientAuth{\n\t\tClientAccount:        *selected,\n\t\tOrgId:                org.Id,\n\t\tOrgName:              org.Name,\n\t\tOrgIsTrial:           org.IsTrial,\n\t\tIntegratedModelsMode: org.IntegratedModelsMode,\n\t})\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error setting auth: %v\", err)\n\t}\n\n\t_, apiErr = apiClient.GetOrgSession()\n\n\tif apiErr != nil {\n\t\treturn fmt.Errorf(\"error getting org session: %v\", apiErr.Msg)\n\t}\n\n\tfmt.Printf(\"✅ Signed in as %s | Org: %s\\n\", color.New(color.Bold, term.ColorHiGreen).Sprintf(\"<%s> %s\", Current.UserName, Current.Email), color.New(term.ColorHiCyan).Sprint(Current.OrgName))\n\tfmt.Println()\n\n\tif !term.IsRepl {\n\t\tterm.PrintCmds(\"\", \"\")\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/auth/account.go#L76-L112","documentation":"setAuth persists the selected account plus resolved org (Id, Name, trial flag, integrated-models mode) into the local auth store. This error wraps any failure from that write. Because setAuth operates on local state, this usually means the auth file could not be written rather than a server problem.","triggerScenarios":"setAuth returns an error while writing the auth JSON to disk — unwritable config directory, permission denied on ~/.plandex/auth.json, disk full, or serialization failure of the ClientAuth payload.","commonSituations":"Read-only home directory or container filesystem; restrictive file permissions left by a previous run running as a different user; disk quota exceeded; corrupted config directory.","solutions":["Check permissions on the Plandex config directory/auth file (e.g. ~/.plandex) and ensure the current user can write it.","Free disk space / fix quota if the disk is full, then retry sign-in.","If the auth file is corrupted, remove it and re-run `plandex signIn` to regenerate it.","In containers/CI, mount the config directory as a writable volume."],"exampleFix":"// before\n-r-------- 1 otheruser auth ~/.plandex/auth.json  (write fails: permission denied)\n// after\nchown -R $USER ~/.plandex && chmod 600 ~/.plandex/auth.json","handlingStrategy":"validation","validationCode":"f, err := os.OpenFile(authPath, os.O_WRONLY|os.O_CREATE, 0600)\nif err != nil {\n    return fmt.Errorf(\"auth store not writable (%s): %v; fix permissions before sign-in\", authPath, err)\n}\nf.Close()","typeGuard":null,"tryCatchPattern":"if err := auth.SelectOrSignInOrCreate(); err != nil {\n    if strings.Contains(err.Error(), \"error setting auth\") {\n        if errors.Is(err, fs.ErrPermission) || errors.Is(err, fs.ErrPermissionWrapped) {\n            return fmt.Errorf(\"cannot write auth file: check ownership/permissions on the plandex config dir\")\n        }\n    }\n    return err\n}","preventionTips":["Run all plandex commands as the same user that owns the config directory.","In containers/CI, mount the config dir as a writable volume and check disk space.","Prefer 0600 permissions on auth files; recreate the file if corrupted."],"tags":["filesystem","auth","permissions"],"backgroundTag":"permission-denied","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}