{"record":{"id":"0007499bbea48e98","repo":"plandex-ai/plandex","slug":"error-setting-auth-cookie","errorCode":null,"errorMessage":"Error setting auth cookie: ","messagePattern":"Error setting auth cookie: ","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/handlers/orgs.go","lineNumber":157,"sourceCode":"\t\treturn\n\t}\n\n\tresp := shared.CreateOrgResponse{\n\t\tId: org.Id,\n\t}\n\n\tbytes, err := json.Marshal(resp)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error marshalling response: %v\\n\", err)\n\t\thttp.Error(w, \"Error marshalling response: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\terr = SetAuthCookieIfBrowser(w, r, auth.User, \"\", org.Id)\n\tif err != nil {\n\t\tlog.Printf(\"Error setting auth cookie: %v\\n\", err)\n\t\thttp.Error(w, \"Error setting auth cookie: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlog.Println(\"Successfully created org\")\n\n\tw.Write(bytes)\n}\n\nfunc GetOrgSessionHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Received request for GetOrgSessionHandler\")\n\n\tauth := Authenticate(w, r, true)\n\n\tif auth == nil {\n\t\treturn\n\t}\n\n\torg, apiErr := getApiOrg(auth.OrgId)","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/orgs.go#L139-L175","documentation":"HTTP 500 error returned by CreateOrgHandler when SetAuthCookieIfBrowser fails to attach the session cookie (for browser-based clients) tying the authenticated user to the newly created org. The org itself has already been created and the response marshalled, but the error prevents the cookie from being set, so the client cannot be associated with the new org session; the marshalled response is never written.","triggerScenarios":"Thrown at app/server/handlers/orgs.go:157 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped cookie error in server logs","Verify cookie signing secret/config is set","Retry; the org exists so only session setup is affected"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}