plandex-ai/plandex · error
error getting plan subtasks: %v
Error message
error getting plan subtasks: %v
What it means
Non-panic variant of the subtask load failure: db.GetPlanSubtasks(auth.OrgId, planId) returned an error, which is logged and wrapped as 'error getting plan subtasks: %v' and sent on errCh in tell_load.go. It indicates the database could not return the plan's subtask rows.
Source
Thrown at app/server/model/plan/tell_load.go:304
convo = append(convo, promptMsg)
}
errCh <- nil
}()
go func() {
defer func() {
if r := recover(); r != nil {
log.Printf("panic in getPlanSubtasks: %v\n%s", r, debug.Stack())
errCh <- fmt.Errorf("error getting plan subtasks: %v\n%s", r, debug.Stack())
runtime.Goexit() // don't allow outer function to continue and double-send to channel
}
}()
res, err := db.GetPlanSubtasks(auth.OrgId, planId)
if err != nil {
log.Printf("Error getting plan subtasks: %v\n", err)
errCh <- fmt.Errorf("error getting plan subtasks: %v", err)
return
}
subtasks = res
errCh <- nil
}()
for i := 0; i < 4; i++ {
err = <-errCh
if err != nil {
go notify.NotifyErr(notify.SeverityError, fmt.Errorf("error loading plan: %v", err))
active.StreamDoneCh <- &shared.ApiError{
Type: shared.ApiErrorTypeOther,
Status: http.StatusInternalServerError,
Msg: fmt.Sprintf("Error loading plan: %v", err),
}
return err
}View on GitHub (pinned to e2d772072e)
Solutions
- Inspect the wrapped DB error in the server log
- Verify the plan exists under auth.OrgId
- Confirm database connectivity and schema migrations
- Retry after transient DB issues are resolved
Example fix
// before
res, err := db.GetPlanSubtasks(auth.OrgId, planId)
if err != nil {
errCh <- fmt.Errorf("error getting plan subtasks: %v", err)
return
}
// after
res, err := db.GetPlanSubtasks(auth.OrgId, planId)
if err != nil {
if errors.Is(err, sql.ErrNoRows) {
errCh <- nil // plan has no subtasks yet
} else {
errCh <- fmt.Errorf("error getting plan subtasks: %w", err)
}
return
} Defensive patterns
Strategy: try-catch
Validate before calling
if auth.OrgId == "" || planId == "" {
return fmt.Errorf("missing orgId or planId")
}
if err := db.Ping(); err != nil {
return fmt.Errorf("database unreachable: %w", err)
} Try / catch
res, err := db.GetPlanSubtasks(auth.OrgId, planId)
if err != nil {
log.Printf("Error getting plan subtasks: %v", err)
errCh <- fmt.Errorf("error getting plan subtasks: %w", err)
return
} Prevention
- Confirm the plan belongs to auth.OrgId before loading
- Keep schema migrations in sync with query code
- Add DB health checks to startup
- Distinguish no-rows from hard errors where appropriate
When it happens
Trigger: GetPlanSubtasks fails: DB connectivity issue, invalid orgId/planId pair, schema mismatch on the subtasks table, or query timeout.
Common situations: Postgres outage or pool exhaustion; plan belongs to a different org than auth.OrgId; missing migration for subtasks table.
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
- error adding plan context tokens: %v
- error inserting new lock: %v
- error committing transaction: %v
- error removing all locks: %v
- error deleting custom models: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/37ca1224edc97822.
Report an issue: GitHub.