Troubleshooting Guide: SQL Server Error 5571 – FILESTREAM Garbage Collection Table Access Failure
Why This Error Happens
Error 5571 occurs when the SQL Server Database Engine cannot internally access the hidden FILESTREAM garbage collection table associated with a filegroup. This is typically caused by corruption in the FILESTREAM data container, insufficient NTFS permissions for the SQL Server service account on the FILESTREAM directory, or an improperly configured/interrupted FILESTREAM filegroup after an OS or storage-level failure. In some cases, this also surfaces after migrating databases to a new Windows Server 2025 instance where the underlying file system ACLs were not preserved.
Step-by-Step Resolution Guide
Step 1: Verify FILESTREAM is Properly Enabled at the Instance Level
- Open SQL Server Configuration Manager > right-click your SQL Server instance > Properties > FILESTREAM tab.
- Ensure “Enable FILESTREAM for Transact-SQL access” and “Enable FILESTREAM for file I/O streaming access” are both checked.
- Confirm via T-SQL:
EXEC sp_configure 'filestream access level';
- If the value is
0, run:
EXEC sp_configure 'filestream access level', 2;
RECONFIGURE;
Step 2: Check NTFS Permissions on the FILESTREAM Data Folder
- Navigate to the physical path of the FILESTREAM filegroup (e.g.,
D:\SQLData\FileStreamData). - Right-click the folder > Properties > Security tab.
- Confirm the SQL Server service account (e.g.,
NT Service\MSSQLSERVER) has Full Control. - If missing, grant it manually:
icacls "D:\SQLData\FileStreamData" /grant "NT Service\MSSQLSERVER:(OI)(CI)F" /T
Step 3: Run Consistency Checks Against the Affected Database
- Execute
DBCC CHECKDBwith the FILESTREAM data included to detect corruption:
DBCC CHECKDB ('YourDatabaseName') WITH ALL_ERRORMSGS, NO_INFOMSGS;
- If corruption is confirmed in the FILESTREAM container, restore from the most recent clean backup rather than attempting in-place repair, as
REPAIR_ALLOW_DATA_LOSSdoes not reliably fix FILESTREAM garbage collection metadata.
Step 4: Rebuild or Re-create the FILESTREAM Filegroup (If Corruption Persists)
- If DBCC reports unrecoverable errors in the FILESTREAM filegroup, drop and recreate the filegroup:
ALTER DATABASE YourDatabaseName REMOVE FILE YourFileStreamLogicalName;
ALTER DATABASE YourDatabaseName ADD FILE
(
NAME = 'NewFileStreamData',
FILENAME = 'D:\SQLData\NewFileStreamData'
) TO FILEGROUP FileStreamGroup1;
- Migrate FILESTREAM columns/data to the new filegroup before dropping the old one.
Step 5: Restart the SQL Server Service and Validate Event Logs
- Restart the SQL Server service via services.msc or PowerShell:
Restart-Service -Name 'MSSQLSERVER' -Force
- Open Event Viewer > Windows Logs > Application and confirm Error 5571 no longer appears after the restart.
Alternative or Verification Steps
- Run
SELECT * FROM sys.filestream_tombstoneandDBCC CHECKDBagain post-fix to confirm the garbage collection table is accessible and no new corruption errors appear in the SQL Error Log. - If the error persists after permission and filegroup repairs, consider restoring the entire database to a new instance on Windows Server 2025 using a verified backup, as this isolates whether the root cause is storage/file-system level rather than database-level.