Confluence XML restore fails because the packet for query is too large

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Problem

An XML backup fails to restore.

Diagnosis

The following appears in the atlassian-confluence.log:

1 2 3 4 5 -- referer: http://localhost:8090/setup/setup-restore-start.action | url: /setup/setup-restore.action | userName: anonymous | action: setup-restore com.atlassian.confluence.importexport.ImportExportException: Unable to complete import: Error while importing backup: could not insert: [com.atlassian.confluence.core.BodyContent#787560] Caused by: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (17825792 > 16777216 ). You can change this value on the server by setting the max_allowed_packet' variable.

Cause

The packet query size exceeds the maximum allowed size that is set in the database configuration, therefore XML restore process will fail.

Solution

Resolution

In order to resolve this, you will need to check the max_allowed_packet set within the MySQL server:

  1. Stop Confluence.

  2. Ensure that the size max_allowed_packet parameter is set to 256MB per our Database Setup For MySQL guide:

    1 max_allowed_packet =256M
  3. Restart the Mysql service.

  4. Restart Confluence.

Updated on April 7, 2025

Still need help?

The Atlassian Community is here for you.