{"record":{"id":"e2bd524e75d3b1b6","repo":"plandex-ai/plandex","slug":"error-getting-plan-convo-v-e2bd52","errorCode":null,"errorMessage":"error getting plan convo: %v","messagePattern":"error getting plan convo: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/server/types/active_plan_pending_builds.go","lineNumber":27,"sourceCode":")\n\nfunc (ap *ActivePlan) PendingBuildsByPath(orgId, userId string, convoMessagesArg []*db.ConvoMessage) (map[string][]*ActiveBuild, error) {\n\tplanDescs, err := db.GetConvoMessageDescriptions(orgId, ap.Id)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting pending build descriptions: %v\", err)\n\t}\n\n\tif !HasPendingBuilds(planDescs) {\n\t\treturn map[string][]*ActiveBuild{}, nil\n\t}\n\n\tvar convoMessages []*db.ConvoMessage\n\tif convoMessagesArg == nil {\n\t\tvar err error\n\t\tconvoMessages, err = db.GetPlanConvo(orgId, ap.Id)\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error getting plan convo: %v\", err)\n\t\t}\n\t} else {\n\t\tconvoMessages = convoMessagesArg\n\t}\n\n\tconvoMessagesById := map[string]*db.ConvoMessage{}\n\tfor _, msg := range convoMessages {\n\t\tconvoMessagesById[msg.Id] = msg\n\t}\n\n\tactiveBuildsByPath := map[string][]*ActiveBuild{}\n\n\tfor _, desc := range planDescs {\n\t\tif (!desc.DidBuild && len(desc.Operations) > 0) || len(desc.BuildPathsInvalidated) > 0 {\n\t\t\tif desc.ConvoMessageId == \"\" {\n\t\t\t\tlog.Printf(\"No convo message ID for description: %v\\n\", desc)\n\t\t\t\treturn nil, fmt.Errorf(\"no convo message ID for description: %v\", desc)\n\t\t\t}","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/types/active_plan_pending_builds.go#L9-L45","documentation":"PendingBuildsByPath wraps any failure from db.GetPlanConvo (the DB query that loads all conversation messages for a plan) with this message. It is thrown when the plan's conversation messages cannot be loaded from the database, and the caller did not supply them via convoMessagesArg. The underlying DB error is preserved in the wrapped %v.","triggerScenarios":"Calling ActivePlan.PendingBuildsByPath with convoMessagesArg == nil while db.GetPlanConvo(orgId, ap.Id) fails: database connection failure, the plan's convo rows missing/corrupt, or a query timeout.","commonSituations":"Postgres down or restarted while queueing pending builds; plan row deleted mid-flight so the convo query errors; transient DB network blips during heavy build queueing; misconfigured DB connection pool exhausted.","solutions":["Inspect the wrapped inner error to identify the actual DB failure (connection, query, or missing rows).","Verify the database is reachable and the connection string/pool is healthy.","Pass the already-loaded convo messages via the convoMessagesArg parameter to skip the DB query entirely.","Retry the call if the underlying error is transient (connection reset, timeout)."],"exampleFix":"// before\nbuilds, err := plan.PendingBuildsByPath(orgId, userId, nil)\n// after\nconvo, err := db.GetPlanConvo(orgId, plan.Id)\nif err != nil {\n    log.Printf(\"plan convo unavailable, aborting: %v\", err)\n    return err\n}\nbuilds, err := plan.PendingBuildsByPath(orgId, userId, convo)","handlingStrategy":"try-catch","validationCode":"// Go has no pre-check API; verify DB connectivity first\nif err := db.PingContext(ctx); err != nil {\n    return fmt.Errorf(\"database unreachable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"builds, err := plan.PendingBuildsByPath(orgId, userId, nil)\nif err != nil {\n    if strings.Contains(err.Error(), \"error getting plan convo\") {\n        // inspect wrapped DB error, retry or pass convoMessagesArg explicitly\n        var convoErr = errors.Unwrap(err)\n        log.Printf(\"plan convo load failed: %v\", convoErr)\n    }\n    return err\n}","preventionTips":["Pass the already-fetched convo messages via convoMessagesArg when available to skip the extra DB query.","Monitor database health and retry transient connection errors.","Keep plan convo rows intact during migrations.","Use context timeouts on DB queries to fail fast with clearer errors."],"tags":["database","go","query-failure"],"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"}