{"record":{"id":"b9a35cfc77156bc0","repo":"plandex-ai/plandex","slug":"error-getting-current-plan-state-v-b9a35c","errorCode":null,"errorMessage":"error getting current plan state: %v","messagePattern":"error getting current plan state: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/model/plan/tell_load.go","lineNumber":332,"sourceCode":"\t\t\t\tgo notify.NotifyErr(notify.SeverityError, fmt.Errorf(\"error loading plan: %v\", err))\n\n\t\t\t\tactive.StreamDoneCh <- &shared.ApiError{\n\t\t\t\t\tType:   shared.ApiErrorTypeOther,\n\t\t\t\t\tStatus: http.StatusInternalServerError,\n\t\t\t\t\tMsg:    fmt.Sprintf(\"Error loading plan: %v\", err),\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tres, err := db.GetCurrentPlanState(db.CurrentPlanStateParams{\n\t\t\tOrgId:    currentOrgId,\n\t\t\tPlanId:   planId,\n\t\t\tContexts: modelContext,\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error getting current plan state: %v\", err)\n\t\t}\n\n\t\tcurrentPlan = res\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tlog.Printf(\"execTellPlan: error loading tell plan: %v\\n\", err)\n\t\tgo notify.NotifyErr(notify.SeverityError, fmt.Errorf(\"error loading tell plan: %v\", err))\n\n\t\tactive.StreamDoneCh <- &shared.ApiError{\n\t\t\tType:   shared.ApiErrorTypeOther,\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tMsg:    fmt.Sprintf(\"Error loading tell plan: %v\", err),\n\t\t}\n\t\treturn err\n\t}","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/model/plan/tell_load.go#L314-L350","documentation":"db.GetCurrentPlanState(db.CurrentPlanStateParams{...}) failed while assembling the current plan state (plan status, contexts, etc.) in tell_load.go, wrapped as 'error getting current plan state: %v'. This runs after the parallel loaders succeed, so the plan itself loaded but the state assembly query failed.","triggerScenarios":"GetCurrentPlanState returns an error: DB failure, context/execution-context rows unreadable, or invalid modelContext passed in params.","commonSituations":"Corrupt or missing current_plan state rows; migration drift; DB connection dropped between the parallel loads and this call.","solutions":["Check the wrapped DB error in the log ('error loading tell plan: error getting current plan state: ...')","Verify plan state tables exist and match the current schema","Re-validate orgId/planId before load","Retry once DB connectivity is restored"],"exampleFix":"// before\nres, err := db.GetCurrentPlanState(db.CurrentPlanStateParams{\n    OrgId: currentOrgId, PlanId: planId, Contexts: modelContext,\n})\nif err != nil {\n    return fmt.Errorf(\"error getting current plan state: %v\", err)\n}\n// after\nres, err := db.GetCurrentPlanState(db.CurrentPlanStateParams{\n    OrgId: currentOrgId, PlanId: planId, Contexts: modelContext,\n})\nif err != nil {\n    return fmt.Errorf(\"error getting current plan state: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"if currentOrgId == \"\" || planId == \"\" {\n    return fmt.Errorf(\"cannot get current plan state: missing orgId or planId\")\n}","typeGuard":"if currentPlan == nil {\n    return fmt.Errorf(\"current plan state is nil after load\")\n}","tryCatchPattern":"res, err := db.GetCurrentPlanState(db.CurrentPlanStateParams{OrgId: currentOrgId, PlanId: planId, Contexts: modelContext})\nif err != nil {\n    return fmt.Errorf(\"error getting current plan state: %w\", err)\n}","preventionTips":["Validate orgId/planId and modelContext before the call","Ensure plan state tables are migrated","Reuse a healthy DB connection across the whole load sequence","Alert on repeated GetCurrentPlanState failures"],"tags":["database","plan-state","postgres"],"backgroundTag":"database-query-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}