plandex-ai/plandex · warning

Invite not found:

Error message

Invite not found: 

What it means

DeleteInviteHandler returns 404 'Invite not found: <inviteId>' when db.GetInvite returns nil or the invite belongs to a different org than the authenticated user. The handler intentionally does not distinguish 'never existed' from 'exists but not yours' to avoid leaking information.

Solutions

  1. Confirm the inviteId is correct and belongs to your current org
  2. Refresh the invite list — the invite may already be deleted or accepted
  3. Retry with a valid invite ID from a fresh GET of the org's invites
Defensive patterns

Strategy: validation

Validate before calling

const invites = await listInvites(orgId)
const invite = invites.find(i => i.id === inviteId)
if (!invite) throw new Error(`Invite ${inviteId} not found in org — refresh list before deleting`)

Try / catch

try {
	await client.deleteInvite(inviteId)
} catch (e) {
	if (e.status === 404) { refreshInviteList(); return } // already gone
	throw e
}

Prevention

When it happens

Trigger: DELETE /invites/{inviteId} with an invite ID that was already deleted/accepted, a typo'd or fabricated ID, or a valid invite belonging to another org the user is not an admin of.

Common situations: Client retries deleting an invite that a prior request already removed; user copies an invite ID from the wrong org; stale UI listing an invite that was resolved moments ago.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/3f44c131e8a28f50. Report an issue: GitHub.

Appendix: source

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

			Msg:    "Trial user can't delete invites",
		})
		return
	}

	vars := mux.Vars(r)
	inviteId := vars["inviteId"]

	invite, err := db.GetInvite(inviteId)

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

	if invite == nil || invite.OrgId != auth.OrgId {
		log.Printf("Invite not found: %v\n", inviteId)
		http.Error(w, "Invite not found: "+inviteId, http.StatusNotFound)
		return
	}

	// ensure current user can remove target invite
	removePermission := shared.Permission(strings.Join([]string{string(shared.PermissionRemoveUser), invite.OrgRoleId}, "|"))

	invitePermission := shared.Permission(strings.Join([]string{string(shared.PermissionInviteUser), invite.OrgRoleId}, "|"))

	if !(auth.HasPermission(removePermission) ||
		(auth.User.Id == invite.InviterId && auth.HasPermission(invitePermission))) {
		log.Printf("User does not have permission to remove invite with role: %v\n", invite.OrgRoleId)
		http.Error(w, "User does not have permission to remove invite with role: "+invite.OrgRoleId, http.StatusForbidden)
		return
	}

	err = db.DeleteInvite(inviteId, nil)

	if err != nil {

View on GitHub (pinned to e2d772072e)