plandex-ai/plandex · error

error getting plan ids for project: %v

Error message

error getting plan ids for project: %v

What it means

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.

Source

Thrown at app/server/db/plan_helpers.go:501

	return nil, nil
}

func BumpPlanUpdatedAt(planId string, t time.Time) error {
	_, err := Conn.Exec("UPDATE plans SET updated_at = $1 WHERE id = $2", t, planId)

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

	return nil
}

func GetPlanIdsForProject(projectId string) ([]string, error) {
	var ids []string
	err := Conn.Select(&ids, "SELECT id FROM plans WHERE project_id = $1", projectId)
	if err != nil {
		return nil, fmt.Errorf("error getting plan ids for project: %v", err)
	}
	return ids, nil
}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Inspect the wrapped inner error for the DB root cause
  2. Verify connectivity and that plans.project_id exists as a column/index
  3. Handle the empty-result case in callers to distinguish 'no plans' from this error
Defensive patterns

Strategy: try-catch

Validate before calling

if projectId == "" {
    return errors.New("projectId is required")
}

Try / catch

ids, err := GetPlanIdsForProject(projectId)
if err != nil {
    return fmt.Errorf("could not list plans: %w", err)
}
// ids may be empty when the project has no plans — handle separately

Prevention

When it happens

Trigger: Conn.Select on `SELECT id FROM plans WHERE project_id = $1` errors — DB connectivity failure or scan error into the ids slice.

Common situations: Database outages, empty-but-valid results are fine (nil vs empty confusion is upstream), schema drift on the plans table breaking the scan.

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