space import error (insert or update on table "spacepermissions" violates foreign key constraint)

raintuur
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 1, 2023

When importing previously exported space I get this error


ERROR: insert or update on table "spacepermissions" violates foreign key constraint "someVeryLongKeyBlaBlaBla" Detail: Key (spaceid)=(123456789) is not present in table "spaces".

note: I changed key constraint value and spaceid

What does it mean and how to resolve it?
Do I need to do something special when exporting space. It used to work without any problems.

4 answers

1 vote
Miguel Ramon
Contributor
August 2, 2023

Reporting I'm running into the same error. This is popping up after I try to import a space exported from a Confluence Cloud instance into another Confluence Cloud instance.

EDIT: I've raised a support request on this and will get back here if I learn anything.

EDIT 2: Heard back from support, this is a known recent bug impacting the XML export process of the space, documented here:

https://jira.atlassian.com/browse/CONFCLOUD-76197

Workaround is to do a CSV export and import that instead.

 

Pronojit Saha
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 29, 2024

I tried the CSV export still getting the same error. Any other options here?

0 votes
Pronojit Saha
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 29, 2024

Getting the exact same issue even with CSV export-import. 

0 votes
Nicholas Ayala January 22, 2024

Migrating from Server to Cloud

I am running into this issue as well. Not sure what is going on. I tried this around November of last year for the 8 spaces that have failed due to attachment errors. But now I am getting the error you have reported with the foreign key constraint and I am also (for other spaces) getting the "Transaction rolled back because it has been marked as rollback-only" error. 

These are the same exact spaces so I am not sure as to why these are now failing to import. This was the only option I had to migrated these over due to the fact that they continued to fail to migrate through the migration assistant for "Failed to migrate space attachments".

Also since I am going from Server to Cloud there is no CSV option. I only have HTML, XML, and PDF.

 


UPDATE (2/29/2024):

Yea the CSV thing doesnt really work.

MUST HAVE ORG-ADMIN PERMISSIONS FOR THE SOLUTION BELLOW.

One option that can work ( I have not tried this myself since my issue is specifically my sandbox ) is doing the import into the confluence cloud sandbox instance. 

  • If they import successfully, you can then use the copy product data feature in admin.atlassian.com

copyProductData.png

  • From here you will select the select the source as the sandbox and the destination as your production environment

confluenceSourceDest.png

Select the projects that you have imported to copy over and start. They will notify you once the process is complete.

 

My specific problem seem to have steemed from corrupted data within my confluence for the specfic projects I had to import. Since they existed before and then they were deleted in order to test the migration again, this had some weird effect on the import. When I did this within a different confluence instance the import worked just fine. 

0 votes
Roger
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 1, 2023

I am receiving the same error when attempting to import multiple spaces yesterday and today. Out of 5 spaces none have succeeded, all reporting this same error, or the more generic "Transaction rolled back because it has been marked as rollback-only" with no further information. It seems to sometimes alternate between the two errors upon re-attempts to import the spaces.

Nicholas Ayala July 25, 2024

Hey @Roger Groom ,

 

Have you tried importing them 1 at a time? I used to get this same error. A lot of the attempts that failed were due to thinking that the space has been deleted (I re-imported several times for testing reasons) but when you delete a space it goes to the trash (soft delete). You need to navigate to trash and remove it there (hard delete). Give it about 5 to 10 minutes and then try again.

If this still doesnt work you can try to import it in a fresh sandbox environment and then try my solution above.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events