Couldn't migrate Request Type with id linked to Issue Type with id
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Check what to do when your project fails to migrate with the error "Couldn't migrate Request Type with id <ID> linked to Issue Type with id <ID>".
Overview
The error message below will surface when a JSM Project Request Type is associated with an Issue Type that was either deleted or is not associated with the Issue Type Scheme linked to that project.
This error can happen when an Issue Type is associated with a Request Type, and later on, that Issue Type is unlinked from the Issue Type Scheme.
That change isn't propagated into the Request Types section, keeping the previous reference there.
ERROR <project key> project-export Couldn't migrate Request Type with id <request type ID> linked to Issue Type with id <issue type ID>.
Add the Issue Type with id <issue type ID> to the Issue type Scheme of the project with id <project ID> to resolve.
Solution
Detection
First, We must identify which Issue Types are referenced in the error message with the SQL Query below.
The query will bring all Issue Types associated with the Request Types of the provided project and list which Issue Types are invalid or not associated with the Issue Type Scheme of that project.
Look for the entry "Issue Type invalid or not associated with the Issue Type Scheme" in the query results.
Edit the lines 12 and 27 to include the <project key>
WITH request_type_issue_type_project AS (
SELECT vpf."ID" AS request_type_id
, vpf."NAME" AS request_type_name
, p.pkey AS project_key
, vp."NAME" AS project_name
, vpf."ISSUE_TYPE_ID" AS issue_type_id
, it.pname AS issue_type_name
FROM "AO_54307E_VIEWPORT" vp
JOIN "AO_54307E_VIEWPORTFORM" vpf ON (vpf."VIEWPORT_ID" = vp."ID")
JOIN project p ON (p.pname = vp."NAME")
LEFT JOIN issuetype it ON (it.id = vpf."ISSUE_TYPE_ID"::text)
WHERE p.pkey = '<project key>'
), issue_type_project AS (
SELECT p.id AS project_id
, p.pname AS project_name
, p.pkey AS project_key
, it.id AS issue_type_id
, it.pname AS issue_type_name
FROM project p
LEFT JOIN configurationcontext cc ON (p.id = cc.project)
LEFT JOIN fieldconfigscheme fcs ON (cc.fieldconfigscheme = fcs.id)
LEFT JOIN fieldconfigschemeissuetype fcsit ON (fcsit.fieldconfigscheme = fcs.id)
LEFT JOIN fieldconfiguration fc ON (fcsit.fieldconfiguration = fc.id)
LEFT JOIN optionconfiguration oc ON (oc.fieldconfig = fc.id)
LEFT JOIN issuetype it ON (oc.optionid = it.id::text)
WHERE cc.customfield = 'issuetype'
AND p.pkey = '<project key>'
AND oc.fieldid = 'issuetype'
)
SELECT rt.request_type_id AS "Request Type ID"
, rt.request_type_name AS "Request Type Name"
, rt.project_key AS "Project Key"
, rt.project_name AS "Project Name"
, rt.issue_type_name AS "Issue Type Name"
, COALESCE(it.issue_type_name, 'Issue Type invalid or not associated with the Issue Type Scheme') AS "Affected Issue Type"
FROM request_type_issue_type_project rt
LEFT JOIN issue_type_project it ON (rt.issue_type_id::text = it.issue_type_id);
Edit the lines 17 and 31 to include the <project key>
SELECT rt.request_type_id AS "Request Type ID"
, rt.request_type_name AS "Request Type Name"
, rt.project_key AS "Project Key"
, rt.project_name AS "Project Name"
, rt.issue_type_name AS "Issue Type Name"
, COALESCE(it.issue_type_name, 'Issue Type invalid or not associated with Issue Type Scheme') AS "Affected Issue Type"
FROM ( SELECT vpf.ID AS request_type_id
, vpf.NAME AS request_type_name
, p.pkey AS project_key
, vp.NAME AS project_name
, vpf.ISSUE_TYPE_ID AS issue_type_id
, it.pname AS issue_type_name
FROM AO_54307E_VIEWPORT vp
JOIN AO_54307E_VIEWPORTFORM vpf ON (vpf.VIEWPORT_ID = vp.ID)
JOIN project p ON (p.pname = vp.NAME)
LEFT JOIN issuetype it ON (it.id = CAST(vpf.ISSUE_TYPE_ID AS UNSIGNED))
WHERE p.pkey = '<project key>' ) rt
LEFT JOIN ( SELECT p.id AS project_id
, p.pname AS project_name
, p.pkey AS project_key
, it.id AS issue_type_id
, it.pname AS issue_type_name
FROM project p
LEFT JOIN configurationcontext cc ON (p.id = cc.project)
LEFT JOIN fieldconfigscheme fcs ON (cc.fieldconfigscheme = fcs.id)
LEFT JOIN fieldconfigschemeissuetype fcsit ON (fcsit.fieldconfigscheme = fcs.id)
LEFT JOIN fieldconfiguration fc ON (fcsit.fieldconfiguration = fc.id)
LEFT JOIN optionconfiguration oc ON (oc.fieldconfig = fc.id)
LEFT JOIN issuetype it ON (CAST(oc.optionid AS UNSIGNED) = it.id)
WHERE cc.customfield = 'issuetype'
AND p.pkey = '<project key>'
AND oc.fieldid = 'issuetype') it ON (rt.issue_type_id = it.issue_type_id)
Edit the lines 12 and 27 to include the <project key>
WITH request_type_issue_type_project AS (
SELECT vpf.ID AS request_type_id
, vpf.NAME AS request_type_name
, p.pkey AS project_key
, vp.NAME AS project_name
, vpf.ISSUE_TYPE_ID AS issue_type_id
, it.pname AS issue_type_name
FROM AO_54307E_VIEWPORT vp
JOIN AO_54307E_VIEWPORTFORM vpf ON (vpf.VIEWPORT_ID = vp.ID)
JOIN project p ON (p.pname = vp.NAME)
LEFT JOIN issuetype it ON (it.id = CAST(vpf.ISSUE_TYPE_ID AS NUMBER))
WHERE p.pkey = '<project key>'
), issue_type_project AS (
SELECT p.id AS project_id
, p.pname AS project_name
, p.pkey AS project_key
, it.id AS issue_type_id
, it.pname AS issue_type_name
FROM project p
LEFT JOIN configurationcontext cc ON (p.id = cc.project)
LEFT JOIN fieldconfigscheme fcs ON (cc.fieldconfigscheme = fcs.id)
LEFT JOIN fieldconfigschemeissuetype fcsit ON (fcsit.fieldconfigscheme = fcs.id)
LEFT JOIN fieldconfiguration fc ON (fcsit.fieldconfiguration = fc.id)
LEFT JOIN optionconfiguration oc ON (oc.fieldconfig = fc.id)
LEFT JOIN issuetype it ON (CAST(oc.optionid AS NUMBER) = it.id)
WHERE cc.customfield = 'issuetype'
AND p.pkey = '<project key>'
AND oc.fieldid = 'issuetype'
)
SELECT rt.request_type_id AS "Request Type ID"
, rt.request_type_name AS "Request Type Name"
, rt.project_key AS "Project Key"
, rt.project_name AS "Project Name"
, rt.issue_type_name AS "Issue Type Name"
, COALESCE(it.issue_type_name, 'Issue Type invalid or not associated with Issue Type Scheme') AS "Affected Issue Type"
FROM request_type_issue_type_project rt
LEFT JOIN issue_type_project it ON (rt.issue_type_id = it.issue_type_id);
Edit the lines 12 and 27 to include the <project key>
WITH request_type_issue_type_project AS (
SELECT vpf.ID AS request_type_id
, vpf.NAME AS request_type_name
, p.pkey AS project_key
, vp.NAME AS project_name
, vpf.ISSUE_TYPE_ID AS issue_type_id
, it.pname AS issue_type_name
FROM AO_54307E_VIEWPORT vp
JOIN AO_54307E_VIEWPORTFORM vpf ON (vpf.VIEWPORT_ID = vp.ID)
JOIN project p ON (p.pname = vp.NAME)
LEFT JOIN issuetype it ON (it.id = CAST(vpf.ISSUE_TYPE_ID AS NVARCHAR(max)))
WHERE p.pkey = '<project key>'
), issue_type_project AS (
SELECT p.id AS project_id
, p.pname AS project_name
, p.pkey AS project_key
, it.id AS issue_type_id
, it.pname AS issue_type_name
FROM project p
LEFT JOIN configurationcontext cc ON (p.id = cc.project)
LEFT JOIN fieldconfigscheme fcs ON (cc.fieldconfigscheme = fcs.id)
LEFT JOIN fieldconfigschemeissuetype fcsit ON (fcsit.fieldconfigscheme = fcs.id)
LEFT JOIN fieldconfiguration fc ON (fcsit.fieldconfiguration = fc.id)
LEFT JOIN optionconfiguration oc ON (oc.fieldconfig = fc.id)
LEFT JOIN issuetype it ON (CAST(oc.optionid AS NVARCHAR(MAX)) = it.id)
WHERE cc.customfield = 'issuetype'
AND p.pkey = '<project key>'
AND oc.fieldid = 'issuetype'
)
SELECT rt.request_type_id AS "Request Type ID"
, rt.request_type_name AS "Request Type Name"
, rt.project_key AS "Project Key"
, rt.project_name AS "Project Name"
, rt.issue_type_name AS "Issue Type Name"
, COALESCE(it.issue_type_name, 'Issue Type invalid or not associated with the Issue Type Scheme') AS "Affected Issue Type"
FROM request_type_issue_type_project rt
LEFT JOIN issue_type_project it ON (rt.issue_type_id = it.issue_type_id);
The Issue Type "DeleteMe", associated with the Request Type "DelMe", is affected.
It could've been deleted or disassociated from the Issue Type Scheme.
You can also edit the affected Request Type by clicking Edit Fields. It'll present the following screen:
Fix
The fix is to either:
- Reassociate the Issue Type with the project's Issue Type Scheme or
- Remove the affected Request Type and recreate it with a valid Issue Type association
Once you have fixed the entry, create and run another JCMA migration plan.