plandex-ai/plandex · error

error getting plan convo: %v

Error message

error getting plan convo: %v

What it means

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.

Source

Thrown at app/server/types/active_plan_pending_builds.go:27

)

func (ap *ActivePlan) PendingBuildsByPath(orgId, userId string, convoMessagesArg []*db.ConvoMessage) (map[string][]*ActiveBuild, error) {
	planDescs, err := db.GetConvoMessageDescriptions(orgId, ap.Id)
	if err != nil {
		return nil, fmt.Errorf("error getting pending build descriptions: %v", err)
	}

	if !HasPendingBuilds(planDescs) {
		return map[string][]*ActiveBuild{}, nil
	}

	var convoMessages []*db.ConvoMessage
	if convoMessagesArg == nil {
		var err error
		convoMessages, err = db.GetPlanConvo(orgId, ap.Id)

		if err != nil {
			return nil, fmt.Errorf("error getting plan convo: %v", err)
		}
	} else {
		convoMessages = convoMessagesArg
	}

	convoMessagesById := map[string]*db.ConvoMessage{}
	for _, msg := range convoMessages {
		convoMessagesById[msg.Id] = msg
	}

	activeBuildsByPath := map[string][]*ActiveBuild{}

	for _, desc := range planDescs {
		if (!desc.DidBuild && len(desc.Operations) > 0) || len(desc.BuildPathsInvalidated) > 0 {
			if desc.ConvoMessageId == "" {
				log.Printf("No convo message ID for description: %v\n", desc)
				return nil, fmt.Errorf("no convo message ID for description: %v", desc)
			}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Inspect the wrapped inner error to identify the actual DB failure (connection, query, or missing rows).
  2. Verify the database is reachable and the connection string/pool is healthy.
  3. Pass the already-loaded convo messages via the convoMessagesArg parameter to skip the DB query entirely.
  4. Retry the call if the underlying error is transient (connection reset, timeout).

Example fix

// before
builds, err := plan.PendingBuildsByPath(orgId, userId, nil)
// after
convo, err := db.GetPlanConvo(orgId, plan.Id)
if err != nil {
    log.Printf("plan convo unavailable, aborting: %v", err)
    return err
}
builds, err := plan.PendingBuildsByPath(orgId, userId, convo)
Defensive patterns

Strategy: try-catch

Validate before calling

// Go has no pre-check API; verify DB connectivity first
if err := db.PingContext(ctx); err != nil {
    return fmt.Errorf("database unreachable: %w", err)
}

Try / catch

builds, err := plan.PendingBuildsByPath(orgId, userId, nil)
if err != nil {
    if strings.Contains(err.Error(), "error getting plan convo") {
        // inspect wrapped DB error, retry or pass convoMessagesArg explicitly
        var convoErr = errors.Unwrap(err)
        log.Printf("plan convo load failed: %v", convoErr)
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/e2bd524e75d3b1b6. Report an issue: GitHub.