I know this error is infuriating — you're just trying to compress a file or folder to save space, and Windows throws 0XC0190056 at you. Happened to me on a SQL Server backup drive once, and it took me an afternoon to track down the real culprit.
The Quick Fix
The error literally means a transaction has the file locked. The fastest way to break it is to reboot the machine. That kills any dangling transactions from SQL Server, Volume Shadow Copy (VSS), or even a stuck file copy.
- Save your work and close all applications.
- Restart Windows (not just a log-off; a full reboot).
- After the restart, right-click the problematic file or folder, go to Properties > General > Advanced, and check Compress contents to save disk space.
- Click OK, then Apply. Choose Apply changes to this folder, subfolders and files if it's a folder.
Nine times out of ten, that's it. The compression completes without error.
Why This Works
NTFS transactions are kernel-level operations that lock file system metadata. SQL Server, for example, wraps backup operations in transactions to ensure consistency. If you try to compress the backup file while that transaction is still open, Windows slaps you with 0XC0190056. A reboot forces all transactions to either commit or roll back, releasing the lock.
The error code itself — STATUS_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION — is a dead giveaway. The NTFS file system doesn't allow compression changes under an active transaction because it could mess up the transaction log's ability to roll back changes.
When the Reboot Doesn't Work
If the error persists after a restart, something is keeping a transaction alive. Here are the usual suspects:
SQL Server Backups
If the file is a SQL Server backup (.bak) or a database file (.mdf, .ldf), run this query to check for active transactions:
SELECT * FROM sys.dm_tran_active_transactions;Then kill the session causing it with KILL <session_id>. After that, retry the compression.
Volume Shadow Copy (VSS)
VSS snapshots hold transactions open on the entire volume. If you see this error on a system drive or a drive with frequent backups, disable VSS temporarily:
- Open an Administrator Command Prompt.
- Type
vssadmin delete shadows /allto remove all shadow copies. - Retry compression.
If that works, consider excluding the compressed folder from future VSS snapshots.
File Explorer or Antivirus
File Explorer can keep a transaction open when previewing files. Close all Explorer windows and try compressing from a Command Prompt:
compact /C "C:\path\to\file"Antivirus software (looking at you, McAfee) sometimes opens files with transactional semantics. Pause real-time scanning for five minutes and test.
Preventing This Error
Honestly, the best prevention is to compress files before they get involved in any transaction. Apply compression to folders that don't host active database backups or VSS snapshots.
If you're using SQL Server, never compress a backup file while the backup is running. Wait until the backup completes. Same for Hyper-V VHDX files — compress them when the VM is shut down.
Set a reminder to reboot your server periodically. Even the best-behaved apps leave tiny transactions hanging around, and a weekly reboot clears them out.
Pro tip from years in the trenches: I once spent three hours chasing this error on a file server, only to find the culprit was a user who had the file open in a network share with a dead session. A quick
net session /deletefixed it. Check that before you reboot.
If none of this works, the file might be corrupt. Run chkdsk /f on the volume to repair any file system issues, then retry the compression.