Prepare seems to fail

I’m using a modified version of the command given in the documentation to create and prepare a backup:

docker run --rm --name "$backup_container_name" \
    --volumes-from "$db_container" \
    -v "$volume_name":/backup_84 \
    --network=container:"$db_container" \
    -it --user root \
    percona/percona-xtrabackup:8.4 \
    /bin/bash -c "
        xtrabackup --backup --compress --datadir=/var/lib/mysql \
                   --target-dir=/backup_84 --host=$db_container \
                   --port=3306 --user=root --password=$MYSQL_ROOT_PASSWORD
        xtrabackup --prepare --target-dir=/backup_84
    "

However in the logs, I see

2025-07-29T14:10:15.379594-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --prepare=1 --target-dir=/backup_84 
xtrabackup version 8.4.0-3 based on MySQL server 8.4.0 Linux (x86_64) (revision id: cccec763)
2025-07-29T14:10:15.379678-00:00 0 [Note] [MY-011825] [Xtrabackup] cd to /backup_84/
2025-07-29T14:10:15.379746-00:00 0 [ERROR] [MY-011825] [Xtrabackup] cannot open ./xtrabackup_info
2025-07-29T14:10:15.379772-00:00 0 [ERROR] [MY-011825] [Xtrabackup] Failed to parse xtrabackup_info from './xtrabackup_info'

I can get the back up to restore, but I’m trying to use this command in a script, and because it fails, the failure bubbles up my script and ends it early. Before I force the script to ignore the error, I’m hoping someone can help me understand what may be going on?

Hi @rsodhia

Could you provide logs of the first command “xtrabackup --backup …” ?

Oh, sorry, I was dumb. It’s because I included the compress flag, which obviously prepare can’t work with until it’s decompressed.