Deleting a project leaves orphaned project_manager/board_membership rows, crashing the home view (blank screen)
Author: BakedPebbleCreated Aug 25, 2026Updated Aug 25, 2026
Deleting a project leaves orphaned project_manager / board_membership rows, which crashes the home view (blank screen)
Where is the problem occurring?
Frontend (home/project view) after a project has been deleted.
Version
v2.2.1 (linuxserver.io docker image, Postgres 16). Reproduced on a fresh install with a single admin user.
Steps to reproduce
- Create one or more projects via the API (
POST /api/projects) — or in the UI; the trigger is any project deletion. - Delete those projects (via
DELETE /api/projects/:idor the UI). - Log in (or reload) and open the home view.
Current behaviour
The home view renders a completely blank screen. Browser console:
TypeError: Cannot read properties of null (reading 'id')
at q.getSeparatedProjectsModelArray
at q.getProjectsModelArray
at q.getFavoriteProjectsModelArray
at Object.selectFavoriteProjectIdsForCurrentUserThe socket connection itself is fine; the crash happens while building the projects model array.
Root cause (verified in the DB)
Deleting a project does not remove its rows from project_manager or board_membership. After deleting 5 test projects, these remained:
SELECT pm.id, pm.project_id FROM project_manager pm
LEFT JOIN project p ON p.id = pm.project_id WHERE p.id IS NULL;
-- 5 rows (all deleted projects)
SELECT bm.id, bm.project_id FROM board_membership bm
LEFT JOIN project p ON p.id = bm.project_id WHERE p.id IS NULL;
-- 4 rowsThe frontend then maps over these stale references and dereferences null when resolving the project, taking down the entire home view. There are also no FK constraints on either table, so nothing at the DB level prevents or catches this.
Desired behaviour (either or both)
- Cascade delete: deleting a project should remove its
project_managerandboard_membershiprows server-side. - Defensive frontend:
getProjectsModelArray/selectFavoriteProjectIdsForCurrentUsershould skip entries whose project no longer exists instead of crashing the whole view. A single stale row should not blank the app.
Workaround (for affected instances)
DELETE FROM project_manager WHERE project_id NOT IN (SELECT id FROM project);
DELETE FROM board_membership WHERE project_id NOT IN (SELECT id FROM project);Related
- #565 "Proper SQL cleanup" (closed 2025-05) — same class of problem; the membership tables were not covered and the issue recurs in v2.x.
- #1026 "Admin cannot delete all Projects and Board" — related orphan-boards discussion.
Source: plankanban/planka