Import Error: No 'key' field for Issue #####

Karrie Dash April 29, 2017

I was originally attempting to do a system restore but after two failed attempts (no longer being able to access Jira), I restored to doing a project import as a test.

I each time I do a project import, I get the following errors:

There was a problem parsing the backup XML file at /var/atlassian/application-data/jira/import/Cloud2.zip: No 'key' field for Issue 26021.

There was a problem parsing the backup XML file at /var/atlassian/application-data/jira/import/Cloud2.zip: No 'key' field for Issue 35418.

What do I need to do to resolve these errors?

4 answers

1 accepted

3 votes
Answer accepted
Karrie Dash November 21, 2018

At the time of the issue, I was able to resolve this by doing the following:

I had to change the permission levels for the "jira" folder on the server to allow access to the account I was using.

I don't know if this is how all systems are set up, but this is what I did. My DevOps guy gave me the ip address & login credentials needed to access the server.

1. Using Putty, I changed the Jira folder permissions to allow my account (provided by DevOps) full access.

2. Using WinSCP, uploaded the zip files to the import folder & attachments folder.

3. Changed the Jira folder permissions back to its original settings.

4. Ran the Project Import

I can't remember if that solved this particular problem but I do remember it being a necessary step.

4 votes
Dan Buffham March 7, 2018

The problem is that you cannot pull a backup straight out of the cloud and import projects into a server version. If you are performing a cloud to server merge/migration or cloud to cloud merge/migration these are steps are required.

Here are the steps to avoid this issue for both operations:

  1. Pull back from source cloud
  2. Run atlassian-xml-cleaner.jar 
    1. Do this every time, regardless if you feel your not going to get an error, it will save you time in the long run.
  3. Stand up a cloud-source-stage "on-prem" server
  4. Restore cleaned backup and attachments
  5. Backup restored cloud-source-stage
  6. Transfer backup and attachments to target-stage
  7. Import projects and attachments to target-stage
    1. Restore to prod-target cloud if going in to Cloud
    2. Restore to Prod Target if going to server.

Hope this helps,

Dan Buffham, ACP

Sue Webber November 11, 2019

Hi, i followed this process and did both activeobjects and entities, but still getting the error, am I missing something?

Like Lisa Barrett likes this
0 votes
Jean-François FORGET August 16, 2018

Hi everyone,

I've successfully imported a Jira cloud project to a Jira 7.8.0 server.

There is a little python 3 script that do the job:

import sys
import codecs
import os

inputFile = "entities.xml"
outputFile = "entities.xml.new"

numberString = "number=\""
numberStringSize = len(numberString)
projectString = "project=\""
projectStringSize = len(projectString)
issueIdString = "<Issue id=\""
issueIdStringSize = len(issueIdString)
stringDelimiter = '"'
keyString = "key=\""
# To fill the dictionary "projectKeyMap", you need to get all the Cloud projects ID and projects Key.
# This can be found in the entities.xml. Search for "<Project id=" in the file and built the dictionary.
# or improve this script to auto generate it from the entities.xml file dynamically
projectKeyMap = {"10000": "ABC","10100": "DEF","10200": "GHI"}

counter = 0
with codecs.open(inputFile, 'r', encoding='utf-8') as fi, \
codecs.open(outputFile, 'w', encoding='utf-8') as fo:
for line in fi:
counter += 1
# update versions of jira and plugins
line = line.replace('#cloud build n°', '#server build n°')
line = line.replace('cloud version', 'server version')
line = line.replace('<OSPropertyString id="specific cloud id" value="cloud build n°"/>','<OSPropertyString id="specific cloud id" value="server build n°"/>')
line = line.replace('cloud plugin 1 version', 'server plugin 1 version')
line = line.replace('cloud plugin 2 version', 'server plugin 2 version')
line = line.replace('cloud plugin x version', 'server plugin x version')

# Add missing "key" in the <issue> entries
if line.find(issueIdString) > 0 and line.find(keyString) == -1:
# Get issue number
tmpLine = line[line.find(numberString)+numberStringSize:]
issueNum = tmpLine[0:tmpLine.find(stringDelimiter)]
# Get project ID
tmpLine = line[line.find(projectString) + projectStringSize:]
projectId = tmpLine[0:tmpLine.find(stringDelimiter)]
# Build issue Key
if len(projectId) > 7:
sys.stderr.write("{0}\n".format(counter))
sys.stderr.write("project id = {0}".format(projectId))
issueKey = "{0}-{1}".format(projectKeyMap[projectId], issueNum)
keyEntry = "{0}{1}{2}".format(keyString, issueKey, stringDelimiter)
# Get issue id
tmpLine = line[line.find(issueIdString) + issueIdStringSize:]
issueId = tmpLine[0:tmpLine.find(stringDelimiter)]
# Build string to replace and replacement string
stringToReplace = "{0}{1}{2}".format(issueIdString, issueId, stringDelimiter)
replacementString = "{0} {1}".format(stringToReplace, keyEntry)
# Replace string
line = line.replace(stringToReplace, replacementString)
# Replace priority labels
line = line.replace('"Blocker"', '"Highest"')
line = line.replace('"Critical"', '"High"')
line = line.replace('"Major"', '"Medium"')
line = line.replace('"Minor"', '"Low"')
line = line.replace('"None"', '"Low"')
# Write data
fo.write(line)

# Remove old file and replace it by the new generated one
os.remove(inputFile)
os.rename(outputFile, inputFile)

 

You will need to adapt it depending of the jira cloud version at the moment you try this andyour jira server version.

I use this file to update many infos that may differ from cloud to server such as:

  • username 
  • priorities
  • Status
  • Customfield names
  • etc...

 

Works like a charm for me.

 

cheers

Stewart Whitman November 20, 2018

Just ran this and it worked to get rid of the No-key field error but then I got stopped with:

This data appears to be from an older version of JIRA. Please upgrade the data and try again. The current version of JIRA is at build number '78002', but the supplied backup file was for build number '72002'.

Going to try to manually update following lines in the entities.xml:
 

<OSPropertyString id="13" value="7.8.0"/>
<OSPropertyString id="1" value="78002"/> 

 

Like Deleted user likes this
Jean-François FORGET January 24, 2019

Hi,

Sorry didn't saw your message.
You have to update the value in the xml file you wan't to import according to your target instance where you wish to restore it.

 

So :

 <OSPropertyString id="1" value="72002"/> 

must be:

 <OSPropertyString id="1" value="78002"/> 

 

Doing this kind of export/import between cloud and server is tricky.
I use to do an export from the cloud version and from the target server instance in order to compare this kind of required fields to allow import.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 29, 2017

I'm afraid this is a bit of a "circular answer".  Your backup is missing data for the field "key", so the project import cannot import it.  The reason it is missing is that you've manged to create an export with missing key data.  So what you need is a valid backup with that data.

Abhishek Ravi August 10, 2017

hi Nic, Unfortunately i am having the same issue. I back uped the JIRA cloud instance by login in System Admin

System-->BAckup Manager--> Create backup for Server (Since i am try to restore this in Server Instance.

Not sure what i am missing.

 

Regards,

Abhishek

Royee Tager September 12, 2017

Have you solved thisi issue?

I'm having the same issue too when trying to restore into server instance (backup is from cloud)

Karrie Dash September 13, 2017

I had to change the permission levels for the "jira" folder on the server to allow access to the account I was using.

I don't know if this is how all systems are set up, but this is what I did. My DevOps guy gave me the ip address & login credentials needed to access the server.

1. Using Putty, I changed the Jira folder permissions to allow my account (provided by DevOps) full access.

2. Using WinSCP, uploaded the zip files to the import folder & attachments folder.

3. Changed the Jira folder permissions back to its original settings.

4. Ran the Project Import

I can't remember if that solved this particular problem but I do remember it being a necessary step.

Suggest an answer

Log in or Sign up to answer