{"record":{"id":"528a35bbb111e16a","repo":"plandex-ai/plandex","slug":"error-getting-plan-ids-for-project-v","errorCode":null,"errorMessage":"error getting plan ids for project: %v","messagePattern":"error getting plan ids for project: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/server/db/plan_helpers.go","lineNumber":501,"sourceCode":"\n\treturn nil, nil\n}\n\nfunc BumpPlanUpdatedAt(planId string, t time.Time) error {\n\t_, err := Conn.Exec(\"UPDATE plans SET updated_at = $1 WHERE id = $2\", t, planId)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error updating plan updated at: %v\", err)\n\t}\n\n\treturn nil\n}\n\nfunc GetPlanIdsForProject(projectId string) ([]string, error) {\n\tvar ids []string\n\terr := Conn.Select(&ids, \"SELECT id FROM plans WHERE project_id = $1\", projectId)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting plan ids for project: %v\", err)\n\t}\n\treturn ids, nil\n}\n","sourceCodeStart":483,"sourceCodeEnd":505,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/db/plan_helpers.go#L483-L505","documentation":"GetPlanIdsForProject selects all plan ids for a project via Conn.Select into a []string. Any query or scan failure (DB unavailable, result rows that don't fit the destination) is wrapped with this message and returned with a nil slice.","triggerScenarios":"Conn.Select on `SELECT id FROM plans WHERE project_id = $1` errors — DB connectivity failure or scan error into the ids slice.","commonSituations":"Database outages, empty-but-valid results are fine (nil vs empty confusion is upstream), schema drift on the plans table breaking the scan.","solutions":["Inspect the wrapped inner error for the DB root cause","Verify connectivity and that plans.project_id exists as a column/index","Handle the empty-result case in callers to distinguish 'no plans' from this error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if projectId == \"\" {\n    return errors.New(\"projectId is required\")\n}","typeGuard":null,"tryCatchPattern":"ids, err := GetPlanIdsForProject(projectId)\nif err != nil {\n    return fmt.Errorf(\"could not list plans: %w\", err)\n}\n// ids may be empty when the project has no plans — handle separately","preventionTips":["Distinguish empty result from error at the call site","Index plans.project_id for reliable, fast lookups","Keep the plans table schema aligned with migrations","Retry transient DB failures"],"tags":["go","database","query"],"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-12T22:17:10.623Z"}