Deleting an unused global work type fails with HTTP 500 "Illegal Entity Scope for Entity class (FIELD_ASSOCIATION_SCHEME)" when a team-managed project's field scheme references the work type

XMLWordPrintable

    • 2
    • Severity 3 - Minor
    • Warranty

      Issue Summary

      Admins can't delete a global work type that has no work items. The delete fails with an HTTP 500 error in both the UI and the REST API (DELETE /rest/api/3/issuetype/{id}{}):

      Illegal Entity Scope for Entity class (FIELD_ASSOCIATION_SCHEME). Expected entity scope 'GLOBAL' but has scope 'PROJECT'

      This happens when a project-scoped field association scheme, which belongs to a team-managed project, has explicit field associations to the global work type being deleted. For example, a custom field such as Story Points may be restricted to that work type. The deletion check expects every scheme that references a global work type to be global. When it finds a project-scoped scheme, it throws an unhandled exception and doesn't clean up the reference.

      The admin has no way to see or remove these project-scoped associations in the UI or the API, so the work type can't be deleted.

      Steps to Reproduce

      1. Have a team-managed project whose field association scheme has explicit associations to one or more global work types. For example, a custom field like Story Points restricted to those global work types.
      2. Make sure the global work types have no work items. The delete page shows "There are currently no matching work items".
      3. Go to Settings > Work items > Work types and try to delete one of those global work types. You can also call DELETE /rest/api/3/issuetype/{id}{}.

      Expected Results

      The unused global work type is deleted. Any field associations that reference it in project-scoped schemes are removed or ignored, or the admin sees a clear message saying which project or configuration is blocking the deletion.

      Actual Results

      The deletion fails with HTTP 500. The UI shows a generic error, and the REST API returns: 
       

      Illegal Entity Scope for Entity class (FIELD_ASSOCIATION_SCHEME). Expected entity scope 'GLOBAL' but has scope 'PROJECT'
      

      The work type stays on the site. The error doesn't say which project or scheme is causing it.

      Notes

      • It's not yet clear how a team-managed project's field scheme ends up with associations to global work types. Root cause is under investigation.
      • In a related symptom, the delete page for an affected work type can show "0 active and 0 archived work items" but also "used by 1 work item in archived projects", without naming a project or work item.

      Workaround

      None available to admins. Contact Atlassian Support to have the stale field associations removed so the work type can be deleted.

              Assignee:
              Su Ann Khoo
              Reporter:
              Mahtab
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: