{"record":{"id":"31f80b0438ccbc82","repo":"plandex-ai/plandex","slug":"error-getting-plan-settings","errorCode":null,"errorMessage":"Error getting plan settings: ","messagePattern":"Error getting plan settings: ","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/handlers/context_helper.go","lineNumber":102,"sourceCode":"\tif mapFilesCount > 0 {\n\t\tlog.Printf(\"[ContextHelper] Processing %d map files out of %d total contexts\", mapFilesCount, totalFiles)\n\t}\n\n\tvar err error\n\n\tvar settings *shared.PlanSettings\n\tvar clients map[string]model.ClientInfo\n\tvar authVars map[string]string\n\tvar orgUserConfig *shared.OrgUserConfig\n\n\tfor _, context := range *loadReq {\n\t\tif context.ContextType == shared.ContextPipedDataType || context.ContextType == shared.ContextNoteType || context.ContextType == shared.ContextImageType {\n\n\t\t\tsettings, err = db.GetPlanSettings(plan)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error getting plan settings: %v\\n\", err)\n\t\t\t\thttp.Error(w, \"Error getting plan settings: \"+err.Error(), http.StatusInternalServerError)\n\t\t\t\treturn nil, nil\n\t\t\t}\n\n\t\t\torgUserConfig, err = db.GetOrgUserConfig(auth.User.Id, auth.OrgId)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error getting org user config: %v\\n\", err)\n\t\t\t\thttp.Error(w, \"Error getting org user config: \"+err.Error(), http.StatusInternalServerError)\n\t\t\t\treturn nil, nil\n\t\t\t}\n\n\t\t\tres := initClients(\n\t\t\t\tinitClientsParams{\n\t\t\t\t\tw:           w,\n\t\t\t\t\tauth:        auth,\n\t\t\t\t\tapiKeys:     context.ApiKeys,\n\t\t\t\t\topenAIOrgId: context.OpenAIOrgId,\n\t\t\t\t\tauthVars:    context.AuthVars,\n\t\t\t\t\tplan:        plan,","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/context_helper.go#L84-L120","documentation":"When the load includes piped data, notes, or images, the server must fetch the plan's settings (db.GetPlanSettings) to resolve the model pack and clients. If that DB-backed lookup fails, the request fails with HTTP 500 and the underlying database/storage error is appended to the message.","triggerScenarios":"Any loadContexts call containing a ContextPipedDataType, ContextNoteType, or ContextImageType context where db.GetPlanSettings(plan) returns an error — corrupt or missing plan settings file, storage backend failure.","commonSituations":"Corrupted .plandex plans dir, interrupted plan creation leaving settings unpersisted, disk/permissions problems on the server's data volume, storage service outage in self-hosted deployments.","solutions":["Inspect the server logs for the wrapped err from db.GetPlanSettings to see the root cause","Verify the plan's settings file exists and is valid JSON in the repo storage (plans/<org>/<plan>)","Check disk space/permissions on the server data directory; restart/recover the storage backend","Re-create the plan if its settings are unrecoverably corrupt"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// pre-check: ensure plan settings file is readable\nif _, err := os.Stat(planDir + \"/settings.json\"); err != nil {\n    return fmt.Errorf(\"plan settings unreadable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"resp, err := doLoad(req)\nif err != nil && strings.Contains(err.Error(), \"Error getting plan settings\") {\n    // inspect server logs / storage health, then retry once\n    resp, err = doLoad(req)\n}","preventionTips":["Monitor disk space and permissions on the server data volume","Back up the plans storage directory","Re-create plans whose settings file is corrupt instead of retrying loads"],"tags":["http-500","database","plan-settings","storage","plandex"],"backgroundTag":"storage-read-failure","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"}