plandex-ai/plandex · error

error getting plan data: %v

Error message

error getting plan data: %v

What it means

loadPendingBuilds wraps any error from its transaction/graceful-db batch (which loads plan settings, org user config, and model context) with this message and returns it to Build. It is an aggregate: the real cause is the underlying error from the batch callback (including errors surfaced on errCh from the loader goroutines, such as 'error getting org user config' or 'error getting plan settings').

Source

Thrown at app/server/model/plan/build_load.go:140

				return
			}

			orgUserConfig = res
			errCh <- nil
		}()

		for i := 0; i < 4; i++ {
			err = <-errCh
			if err != nil {
				log.Printf("Error getting plan data: %v\n", err)
				return err
			}
		}
		return nil
	})

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

	UpdateActivePlan(plan.Id, branch, func(ap *types.ActivePlan) {
		ap.Contexts = modelContext
		for _, context := range modelContext {
			if context.FilePath != "" {
				ap.ContextsByPath[context.FilePath] = context
			}
		}
	})

	state.modelContext = modelContext
	state.settings = settings
	state.orgUserConfig = orgUserConfig

	return pendingBuildsByPath, nil
}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Look at the wrapped inner error and the log lines emitted during the load (e.g. 'Error getting plan settings' / 'Error getting org user config') to identify the real cause.
  2. Fix the underlying DB issue: connectivity, missing rows, or migrations.
  3. Ensure auth and plan objects are fully populated before calling Build.
  4. Retry the build if the inner error was transient (timeout, deadlock).
Defensive patterns

Strategy: try-catch

Validate before calling

if plan == nil || plan.Id == "" {
    return fmt.Errorf("plan must be loaded before building")
}
if err := db.Ping(); err != nil {
    return fmt.Errorf("database unavailable: %v", err)
}

Try / catch

plan, err := Build(req)
if err != nil {
    var inner = errors.Unwrap(err) // inspect the wrapped load error
    log.Printf("plan data load failed: %v (cause: %v)", err, inner)
    if isRetryable(inner) {
        plan, err = Build(req)
    }
}

Prevention

When it happens

Trigger: Any of the four errCh sends or the graceful batch callback returns an error during Build -> loadPendingBuilds: plan settings load failure, org user config load failure, model context load failure, or transaction rollback.

Common situations: Database connectivity problems during plan build startup; missing plan settings or org-user config rows; a recovered panic in one of the loader goroutines (see errors 665/666); concurrent plan state invalidation.

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/b47d9ab4620348ec. Report an issue: GitHub.