plane icon indicating copy to clipboard operation
plane copied to clipboard

[bug]: Can't delete custom project states

Open SawyerCzupka opened this issue 1 week ago โ€ข 3 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Current behavior

When I delete a workflow state from a project in a workspace, it disappears from the list, but when I refresh the page, the deleted state reappears.

What should happen is the workflow state gets deleted and does not reappear on subsequent page refreshes.

I believe the state is merely getting removed from the web UI when deleted, but is not actually getting deleted on the backend.

Steps to reproduce

Plane Community Edition v1.2.0 deployed using Helm chart v1.4.1

  1. Go to a project where the current user is an admin.
  2. Open project settings > states.
  3. Create a new state in any category.
  4. Delete the state (state will disappear from web UI)

DevTools Network Tab: DELETE <instance_url>/api/workspaces/<my_workspace>/projects/e2264f72-c655-496c-8305-90ed3a259943/states/3a2cbc28-f3c5-4d30-8c4c-c1e0d1fb5f01/

Project ID and State ID in API request are correct.

Returns HTTP 204 with no response content.

  1. Refresh the page (state will reappear and was not deleted)

Makes an API request to /api/workspaces/<my_workspace>/projects/e2264f72-c655-496c-8305-90ed3a259943/states/

Response object includes all project states, including the states that were supposed to be deleted.

Environment

Production

Browser

Mozilla Firefox

Variant

Self-hosted

Version

v1.2.0

SawyerCzupka avatar Dec 23 '25 22:12 SawyerCzupka

Synced with Plane Workspace ๐Ÿ”„

[GIT-30] [bug]: Can't delete custom project states

makeplane[bot] avatar Dec 23 '25 22:12 makeplane[bot]

๐Ÿ“ CodeRabbit Plan Mode

Generate an implementation plan and prompts that you can use with your favorite coding agent.

  • [ ] Create Plan
Examples

๐Ÿ”— Similar Issues

Related Issues

  • https://github.com/makeplane/plane/issues/7043
  • https://github.com/makeplane/plane/issues/6894
  • https://github.com/makeplane/plane/issues/5768
  • https://github.com/makeplane/plane/issues/6929
  • https://github.com/makeplane/plane/issues/6718
๐Ÿ‘ค Suggested Assignees

๐Ÿงช Issue enrichment is currently in open beta.

You can configure auto-planning by selecting labels in the issue_enrichment configuration.

To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

issue_enrichment:
  auto_enrich:
    enabled: false

๐Ÿ’ฌ Have feedback or questions? Drop into our discord or schedule a call!

coderabbitai[bot] avatar Dec 23 '25 22:12 coderabbitai[bot]

Root Cause Analysis (by Claude Code)

I investigated the PostgreSQL database directly and found that:

  1. The DELETE endpoint IS working correctly - it's performing a soft delete by setting the deleted_at timestamp on the state record.

  2. The bug is in the GET endpoint - The GET /api/workspaces/<workspace>/projects/<project_id>/states/ endpoint is returning ALL states, including soft-deleted ones, instead of filtering them out.

Database Evidence

The states table schema includes a deleted_at column for soft deletion:

  • deleted_at is NULL for active states
  • deleted_at contains a timestamp for deleted states

When I deleted states via the UI:

  • The DELETE API correctly set deleted_at to a timestamp (e.g., 2025-12-23 23:02:08.916523+00)
  • However, subsequent GET requests still returned these soft-deleted states in the response

Expected Fix

The states list endpoint should filter the queryset to exclude soft-deleted records:

# Current (incorrect) behavior - returns all states
states = State.objects.filter(project_id=project_id)

# Expected behavior - should exclude soft-deleted states
states = State.objects.filter(project_id=project_id, deleted_at__isnull=True)

Workaround

Until this is fixed, deleted states can be permanently removed with: DELETE FROM states WHERE deleted_at IS NOT NULL;

SawyerCzupka avatar Dec 23 '25 23:12 SawyerCzupka