Unable to move issue to another Issue Type due to 'The issue type selected is invalid' error

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptom

  1. In JIRA applications, when moving issues from one Issue Type to another one or even between projects, the operation fails with the below error message;


    The issue type selected is invalid

  2. When moving an issue to another project, the project selection may not be correctly displayed. In this case, the below error can be seen in the browser's console;

    Uncaught TypeError: Cannot read property 'toLowerCase' of undefined

Cause

In a JIRA, the "Default Issue Type Scheme" should include all issue types present on the instance. When that's not the case, multiple problems can occur, such as the failure when moving issues.

There is a bug raised to fix this problem:  JRA-46227 - Getting issue details... STATUS

For more information on Atlassian bug fix policy, please check the this page.



There are two possible causes for problems related to this.

  1. When the target issue type is not included in "Default Issue Type Scheme". You can determine which issue types are missing on that scheme by running the following query on the JIRA database;

    SELECT id, pname FROM issuetype WHERE id NOT IN (SELECT optionid FROM optionconfiguration WHERE fieldconfig = 10000 AND fieldid = 'issuetype');
    
  2. When JIRA somehow reads another Issue Type Scheme as the default, instead of the "Default Issue Type Scheme";

    This can be determined by running the following query against your database. The id returned should be 10000. If it's not 10000, then follow the workaround below.

    select id from configurationcontext where customfield = 'issuetype' and project is null
    

Workaround

Cause 1

As most default schemes in JIRA the "Default Issue Type Scheme" is read-only, so we need to manually add the missing issue types through the database.

If you are using *JIRA Cloud* please reference this document for the workaround.

As manual data manipulation will be necessary, please make sure you have an up-to-date backup of JIRA.

tip/resting Created with Sketch.

The SQL shown below applies to PostgreSQL and may need to be modified to work in other databases


  1. Shut down JIRA;
  2. Identify the missing values:

    SELECT id, pname FROM issuetype WHERE id NOT IN (SELECT optionid FROM optionconfiguration WHERE fieldconfig = 10000 AND fieldid = 'issuetype');
  3. Use the following SQL statement to add the missing entries from previous step. Repeat the query as many times as necessary until you've added all missing issue types;

    INSERT INTO optionconfiguration VALUES ((SELECT MAX(oc.id)+1 FROM optionconfiguration oc), 'issuetype', '10000', 10000, (SELECT MAX(oc.sequence)+1 FROM optionconfiguration oc WHERE oc.fieldconfig=10000));

    (info) Replace <missing_issue_type_id> with the ID of the missing field;

  4. Fix the sequence_value_item table to avoid key violations

    UPDATE sequence_value_item SET seq_id = (SELECT MAX(id)+100 FROM optionconfiguration) WHERE seq_name = 'OptionConfiguration'; 
  5. Start JIRA

  6. Go to Administration > System > Indexing and perform a full re-index by selecting the Lock JIRA and re-build indexes option;


tip/resting Created with Sketch.

Temporary workaround without fixing the DB

Some customers reported that this worked for them:

Search for issue through the issue navigator and use the bulk change to move the issue.

Cause 2

This will restore 'Default Issue Type Scheme' as the default scheme JIRA application uses

  1. Shut down JIRA;
  2. Run the below SQL queries in JIRA's database;

    DELETE FROM configurationcontext WHERE id IN (SELECT cc.id FROM configurationcontext cc WHERE cc.customfield = 'issuetype' AND project IS NULL);
    INSERT INTO configurationcontext VALUES (10000, NULL, NULL, 'issuetype', 10000);
  3. Fix the sequence_value_item table to avoid key violations

     UPDATE sequence_value_item SET seq_id = (SELECT MAX(id)+100 FROM configurationcontext) WHERE seq_name = 'ConfigurationContext'; 
  4. Start JIRA;

Last modified on May 3, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.