When does this error happen?
You're running a backup job — maybe from a maintenance plan, maybe from a T-SQL command — and you turned on compression with MAXTRANSFERSIZE or COMPRESSION option. The job fails with error 3041: "BACKUP failed to complete the command". The backup file might be 0 bytes or missing. This happens a lot on SQL Server 2016 through 2022, especially when you're backing up to a network drive or using a third-party backup tool that pushes compression.
What's actually happening here?
SQL Server tries to compress the backup stream. But behind the scenes, the compression engine needs enough contiguous memory and I/O bandwidth. The error 3041 is a catch-all: it means the backup operation couldn't finish for some reason. The two biggest triggers are:
- Disk space — The backup file grows slower with compression, but if the target location runs out of space mid-way, SQL Server cancels the whole backup. It won't finish writing. The error code is 3041, not a disk full error.
- Trace flag 3041 — In some builds, SQL Server doesn't report compression failures clearly. You need trace flag 3041 enabled to see the actual reason in the log. Without it, you just get the generic 3041 error.
What about the backup to URL scenario?
If you're backing up to Azure Blob or S3-compatible storage, the error often shows up because the backup file size exceeds the 1 TB limit for a single backup file on certain storage backends. Or the network timeout is too short for a large compressed backup. But that's a different category — here we're talking about local or network disk backups.
The fix — step by step
- Check disk space on the target drive
RunEXEC xp_fixeddrivesor check with PowerShell. You need at least 1.5x the size of the final compressed backup. For a 50 GB database, that's around 75 GB free. SQL Server writes a temporary file during compression, so it needs room to expand before contracting. If you see less than that, free up space or change the target. - Enable trace flag 3041 globally
This makes SQL Server log the real reason for the failure. Run this:
Then retry the backup. Check the SQL Server error log for a more detailed message. It might say something likeDBCC TRACEON(3041, -1); GO -- Confirm DBCC TRACESTATUS();"Insufficient disk space"or"Compression failure: I/O error". - Check MAXTRANSFERSIZE and BUFFERCOUNT
If you're usingMAXTRANSFERSIZE = 65536(the default for compression), some older Windows Server builds have issues with large I/Os. Set it explicitly toMAXTRANSFERSIZE = 1048576(1 MB) andBUFFERCOUNT = 32. Example:
This gives SQL Server smaller I/O chunks, which reduces memory pressure.BACKUP DATABASE MyDB TO DISK = 'D:\Backups\MyDB.bak' WITH COMPRESSION, MAXTRANSFERSIZE = 1048576, BUFFERCOUNT = 32; - Disable third-party backup tools temporarily
Tools like Redgate or Idera often intercept the backup command. They can break compression handling. Try running the backup from a simpleBACKUP DATABASEcommand in SSMS. If it works, the issue is the third-party tool. Update it or change its compression settings. - Verify the SQL Server version and patch level
RunSELECT @@VERSION. Microsoft fixed several compression bugs in cumulative updates for SQL Server 2017 and 2019. If you're on an older CU, apply the latest one. For example, SQL Server 2019 CU14 had a fix for backup compression failures on large databases. Without the patch, you get error 3041 randomly.
What to check if it still fails
- Check the Windows System Event Log — Look for disk errors, like
Event ID 11(controller error) or153(disk timeout). The drive might be failing. Replace the drive. - Test with compression off
RunBACKUP DATABASE MyDB TO DISK = '...' WITH NO_COMPRESSION;. If it succeeds, the issue is compression-specific. Then try theWITH COMPRESSION (ALGORITHM = MS_EXPRESS)option (available in SQL Server 2022). It uses less memory. - Check user permissions — The SQL Server service account needs
ALTER ANY DATABASEandCREATE BACKUP DEVICE. Also write permission on the target folder. Deny write access gives you 3041 too. - Look at the SQL Server error log timestamp — If the error happens at the same time every day, something else is running (like a full backup or a large query) that starves memory. Schedule the backup at a different time.
If you've done all this and it still fails, you might have a corrupted database file. Run DBCC CHECKDB to check. A corrupted database can cause backup compression to abort. Fix the corruption first, then try again.