plandex-ai/plandex · error

Error listing invites:

Error message

Error listing invites: 

What it means

ListPendingInvitesHandler wraps any error from db.ListPendingInvites(auth.OrgId) into an HTTP 500 prefixed with 'Error listing invites: '. This is the core SELECT of pending invites for the org; the error indicates the query failed rather than an empty result (an empty list would marshal fine). Server-side data-layer failure.

Source

Thrown at app/server/handlers/invites.go:199

		log.Printf("Error getting org: %v\n", err)
		http.Error(w, "Error getting org: "+err.Error(), http.StatusInternalServerError)
		return
	}

	if org.IsTrial {
		writeApiError(w, shared.ApiError{
			Type:   shared.ApiErrorTypeTrialActionNotAllowed,
			Status: http.StatusForbidden,
			Msg:    "Trial user can't list invites",
		})
		return
	}

	invites, err := db.ListPendingInvites(auth.OrgId)

	if err != nil {
		log.Printf("Error listing invites: %v\n", err)
		http.Error(w, "Error listing invites: "+err.Error(), http.StatusInternalServerError)
		return
	}

	var apiInvites []*shared.Invite
	for _, invite := range invites {
		apiInvites = append(apiInvites, invite.ToApi())
	}

	bytes, err := json.Marshal(apiInvites)

	if err != nil {
		log.Printf("Error marshalling invites: %v\n", err)
		http.Error(w, "Error marshalling invites: "+err.Error(), http.StatusInternalServerError)
		return
	}

	w.Write(bytes)
	log.Println("Successfully processed request for ListPendingInvitesHandler")

View on GitHub (pinned to e2d772072e)

Solutions

  1. Read the server log for the wrapped underlying DB error
  2. Verify the invites table schema matches what ListPendingInvites expects
  3. Check DB health, pool sizing, and query timeouts
  4. Retry after resolving; add pagination/limit if the invites result set is huge

Example fix

// before
if err != nil {
    http.Error(w, "Error listing invites: "+err.Error(), http.StatusInternalServerError)
    return
}
// after
if err != nil {
    log.Printf("Error listing invites: %v\n", err)
    writeApiError(w, shared.ApiError{Type: shared.ApiErrorTypeOther, Status: http.StatusInternalServerError, Msg: "Failed to list invites, please try again"})
    return
}
Defensive patterns

Strategy: retry

Validate before calling

// no client-side pre-check possible; server-side verify schema before deploy:
// psql -c "\\d invites" must match the columns ListPendingInvites selects

Type guard

func isListInvitesServerError(statusCode int, body string) bool {
    return statusCode == http.StatusInternalServerError && strings.Contains(body, "Error listing invites")
}

Try / catch

resp, err := client.Get(pendingInvitesUrl)
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode == 500 && strings.Contains(string(body), "Error listing invites") {
    return fmt.Errorf("transient DB error listing invites; retry with backoff: %s", body)
}

Prevention

When it happens

Trigger: GET to the pending-invites endpoint where the ListPendingInvites query fails: Postgres down, pool exhaustion, query timeout, invites table missing or columns changed after migration, row scan/type mismatch, or canceled request context.

Common situations: Partially applied migrations altering the invites schema; database overload returning timeouts; connection leaks under load; deploying new code against an old schema (or vice versa).

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