plandex-ai/plandex · error
error getting all invites for org: %v
Error message
error getting all invites for org: %v
What it means
ListAllInvites selects every invite (accepted or pending) for an org. All non-nil errors from Conn.Select are wrapped with this message; an empty org simply yields a nil slice. It indicates the org-wide invite listing query failed at the database level.
Source
Thrown at app/server/db/invite_helpers.go:68
}
func ListPendingInvites(orgId string) ([]*Invite, error) {
var invites []*Invite
err := Conn.Select(&invites, "SELECT * FROM invites WHERE org_id = $1 AND accepted_at IS NULL", orgId)
if err != nil {
return nil, fmt.Errorf("error getting pending invites for org: %v", err)
}
return invites, nil
}
func ListAllInvites(orgId string) ([]*Invite, error) {
var invites []*Invite
err := Conn.Select(&invites, "SELECT * FROM invites WHERE org_id = $1", orgId)
if err != nil {
return nil, fmt.Errorf("error getting all invites for org: %v", err)
}
return invites, nil
}
func ListAcceptedInvites(orgId string) ([]*Invite, error) {
var invites []*Invite
err := Conn.Select(&invites, "SELECT * FROM invites WHERE org_id = $1 AND accepted_at IS NOT NULL", orgId)
if err != nil {
return nil, fmt.Errorf("error getting accepted invites for org: %v", err)
}
return invites, nil
}
func GetPendingInvitesForEmail(email string) ([]*Invite, error) {
email = strings.ToLower(email)View on GitHub (pinned to e2d772072e)
Solutions
- Run pending DB migrations so SELECT * columns match the Invite struct.
- Validate orgId (UUID parse) in the handler before calling.
- Check connectivity/pool errors in the wrapped cause.
- Replace SELECT * with an explicit column list for resilience.
Example fix
// before err := Conn.Select(&invites, "SELECT * FROM invites WHERE org_id = $1", orgId) // after err := Conn.Select(&invites, "SELECT id, org_id, email, name, inviter_id, org_role_id, accepted_at, created_at FROM invites WHERE org_id = $1", orgId)
Defensive patterns
Strategy: try-catch
Validate before calling
if _, err := uuid.Parse(orgId); err != nil {
return fmt.Errorf("invalid org id %q", orgId)
} Try / catch
invites, err := db.ListAllInvites(orgId)
if err != nil {
if pgErr, ok := asPG(err); ok && pgErr.Code == "42P01" {
return fmt.Errorf("missing table — check migrations: %w", err)
}
return fmt.Errorf("list all invites: %w", err)
} Prevention
- Deploy schema migrations atomically with (or before) new server binaries.
- Use explicit column lists in queries instead of SELECT *.
- Validate orgId format before calling.
- Add retry-with-backoff for transient connection errors in list endpoints.
- Alert on wrapped DB errors to catch outages quickly.
When it happens
Trigger: Conn.Select("SELECT * FROM invites WHERE org_id = $1", orgId) fails: bad org_id format vs. uuid column, connection failure/timeout, or schema drift causing scan errors into the Invite struct. Called from ListAllInvitesHandler.
Common situations: Admin UI listing all invites right after a schema migration was added but the server binary (or Invite struct) is older, or transient DB outages during traffic spikes.
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 getting pending invites for org: %v
- error getting accepted invites for org: %v
- error getting invites and org names for email: %v
- error creating invite: %v
- error getting invite: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/f94572e071f5af65.
Report an issue: GitHub.