Project Import fail with com.atlassian.jira.exception.ParseException: Invalid label
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
Problem
Trying to perform Project Import will fail with Invalid label error and the following appears in the atlassian-jira.log
2016-11-03 07:27:37,825 JiraTaskExectionThread-2 WARN XXXXX 440x1935x1 XXXXXX 172.18.16.192 /secure/admin/ProjectImportSelectProject.jspa [imports.project.handler.ChainedSaxHandler] Encountered a parsing exception.
com.atlassian.jira.exception.ParseException: Invalid label 'something: 123456' specified.
Diagnosis
Database
Checking the source instance database for labels information with the following will show the affected label with blank space
select * from label;
XML Backup
Unzipping the .zip file and run the following on the
entities.xml
will list the affected label with blank spacegrep '<Label' entities.xml
Cause
There is a blank space in one of the label value which is not expected. No space is allowed in a label.
Workaround
Manually remove the affected label from the database or from the entities.xml
- From database
- Create a database backup
- delete the line that has the affected label
- From entities.xml
- Create a copy of entities.xml
- delete the line that has the affected label eg:
grep -v 'something:\ 123456' entities_copy.xml