0XC01A002A

Fix STATUS_LOG_CONTAINER_STATE_INVALID (0XC01A002A) Fast

SQL Server log shipping or Always On AG hits this when a log container state gets corrupted. Usually a pending snapshot or a failed restore. Here's how to clear it.

Cause 1: Pending log backup or restore operation stuck

The most common trigger for 0XC01A002A is a log backup or restore that never completed. This usually happens after a sudden failover or when someone killed a session mid-operation. The log container gets left in a weird state, and the log service refuses to touch it until you clean up.

Here's the fix. Check for any active log-related sessions, then kill them if they're stuck:

-- Find stuck log sessions
SELECT session_id, command, status, blocking_session_id
FROM sys.dm_exec_requests
WHERE command LIKE '%LOG%' OR command LIKE '%BACKUP%' OR command LIKE '%RESTORE%';

-- Kill the stuck session (replace 123 with actual session_id)
KILL 123;

Once you've cleared the stuck sessions, run a fresh transaction log backup on the primary database:

BACKUP LOG YourDatabase TO DISK = 'C:\Backups\YourDatabase_Log.bak' WITH INIT;

Then restore that log backup on the secondary (if you're using log shipping) or let AG catch up:

RESTORE LOG YourDatabase FROM DISK = 'C:\Backups\YourDatabase_Log.bak' WITH NORECOVERY;

If the container state still complains, you might need to force a checkpoint on the primary to flush the log:

CHECKPOINT;

This clears the pending state in most cases. Don't bother restarting SQL Server first—do that only if the above fails.

Cause 2: Corrupted log container from a failed snapshot

Another common cause is a VSS snapshot that didn't complete properly. If you're backing up with a third-party tool (like Veeam or Commvault) that uses VSS, a failed snapshot can leave the log container in an invalid state. The log service sees it as inconsistent and throws 0XC01A002A.

To confirm this, check the SQL Server error log for entries before the error:

EXEC xp_readerrorlog 0, 1, N'VSS', NULL, NULL, NULL, N'DESC';

If you see VSS-related errors, the fix is to make sure all VSS writers are healthy. Open a command prompt as admin and run:

vssadmin list writers

Look for any writer with a "Failed" status. If SQL Writer shows failed, that's your culprit. Reboot the server—it's the most reliable way to fix the VSS writer state. Then test a manual snapshot before relying on your backup tool again.

If you can't reboot right away, you can try to restart the VSS service and the SQL Writer service:

net stop vss
net start vss
net stop SQLWriter
net start SQLWriter

This often restores the writer to a healthy state without a full reboot.

Cause 3: Inconsistent log chain in Always On Availability Groups

The last usual suspect is a broken log chain in an AG. This happens when a secondary replica gets out of sync, or when a log backup was taken from the wrong replica. The log container state becomes invalid because the LSNs don't line up.

First, check the AG health:

SELECT ar.replica_server_name, ars.synchronization_state_desc, ars.last_hardened_lsn, ars.last_redone_lsn
FROM sys.dm_hadr_availability_replica_states ars
JOIN sys.availability_replicas ar ON ars.replica_id = ar.replica_id;

If you see any secondary with a state other than SYNCHRONIZED, you need to resume the data movement:

ALTER DATABASE YourDatabase SET HADR RESUME;

If that doesn't fix it, you'll need to remove the database from the AG and re-add it. That's the nuclear option, but it's the only way to rebuild the log chain cleanly:

-- On primary
ALTER DATABASE YourDatabase SET HADR OFF;
-- On secondary
DROP DATABASE YourDatabase;
-- Re-add via wizard or script

After re-adding, make sure you take a full backup and restore with NORECOVERY on the secondary before joining.

Quick reference

CauseFix
Stuck log backup/restoreKill stuck sessions, run new log backup and restore
Failed VSS snapshotRestart VSS and SQL Writer services, else reboot
Broken AG log chainResume HADR, or remove/re-add database to AG

That covers the fixes I've used in production. If you still see the error after trying all three, it's time to check for hardware issues or a corrupted transaction log file—but that's rare. In most cases, the first fix clears it right up.

Related Errors in Server & Cloud
Fix Azure Disk Not Detected on VM After Resize 0X000004DA Fix ERROR_ALREADY_REGISTERED (0X000004DA) on Windows Server 0X000010FF Fix ERROR_REMOTE_STORAGE_NOT_ACTIVE (0X000010FF) cPanel File Manager Upload Fails for Files Over 2MB

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.