plandex-ai/plandex · error

error creating invite: %v

Error message

error creating invite: %v

What it means

Inside the CreateInviteHandler transaction, db.CreateInvite fails to insert the invite row, aborting the tx. Duplicate/invite-already-exists is pre-checked; this is a DB-level insert failure (constraint, connection).

Source

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

	if invite != nil {
		log.Println("Invite already exists")
		http.Error(w, "Invite already exists", http.StatusBadRequest)
		return
	}

	err = db.WithTx(r.Context(), "invite user", func(tx *sqlx.Tx) error {

		err = db.CreateInvite(&db.Invite{
			OrgId:     auth.OrgId,
			OrgRoleId: req.OrgRoleId,
			Email:     req.Email,
			Name:      req.Name,
			InviterId: currentUserId,
		}, tx)

		if err != nil {
			log.Printf("Error creating invite: %v\n", err)
			return fmt.Errorf("error creating invite: %v", err)
		}

		err = email.SendInviteEmail(req.Email, req.Name, auth.User.Name, org.Name)

		if err != nil {
			log.Printf("Error sending invite email: %v\n", err)
			return fmt.Errorf("error sending invite email: %v", err)
		}

		return nil
	})

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

View on GitHub (pinned to e2d772072e)

Solutions

  1. Read the wrapped CreateInvite error for the DB cause
  2. Confirm org/role ids in the request are valid
  3. Retry; the tx rollback leaves no partial invite
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at app/server/handlers/invites.go:140 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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