How to fix Error 5523 on Windows Server 2025 / Windows 11

Why This Error Happens

This error occurs because SQL Server requires a valid, non-empty FILESTREAM log file group before a data file group can reference it. Typically, the FILESTREAM log file group was created but never had an actual log file added to it, leaving it in an “empty” state that SQL Server rejects as a valid parent object. This often happens when database creation scripts are run out of sequence or when a migration script omits the file-group-to-file mapping step.

Step-by-Step Resolution Guide

Step 1: Verify the Current File Group Structure

  • Open SQL Server Management Studio (SSMS) and connect to your SQL Server 2025 instance.
  • Run the following query to inspect existing file groups:
  SELECT name, type_desc, is_default FROM sys.filegroups;
  • Confirm whether your FILESTREAM log file group (e.g., FileStreamLogGroup) has zero files associated with it.

Step 2: Add a Physical File to the Empty Log File Group

  • Use ALTER DATABASE to add an actual file to the empty FILESTREAM file group before referencing it:
  ALTER DATABASE [YourDatabase]
  ADD FILE (
      NAME = N'FileStreamLog',
      FILENAME = N'C:\SQLData\FileStreamLog'
  ) TO FILEGROUP [FileStreamLogGroup];
  • Ensure the target directory (e.g., C:\SQLData\) exists and is empty, since FILESTREAM requires an unused folder for its container.
  • On Windows Server 2025 / Windows 11, confirm the SQL Server service account has Full Control NTFS permissions on this folder via Properties > Security.

Step 3: Enable FILESTREAM at the Instance Level

  • Open SQL Server Configuration Manager, right-click your SQL Server instance, and select Properties.
  • Under the FILESTREAM tab, ensure “Enable FILESTREAM for Transact-SQL access” is checked.
  • Restart the SQL Server service for changes to take effect:
  Restart-Service -Name 'MSSQLSERVER'

Step 4: Re-Attempt Adding the Data File Group

  • Once the log file group has a valid file, re-run your original command to add the data file group:
  ALTER DATABASE [YourDatabase]
  ADD FILEGROUP [FileStreamDataGroup] CONTAINS FILESTREAM;
  • Confirm there are no residual locks or open transactions on the database using sp_who2 before executing.

Alternative or Verification Steps

  • Run SELECT * FROM sys.database_files; to confirm the new FILESTREAM log file now appears with a valid physical_name and is mapped to the correct file group ID.
  • If the error persists, drop and recreate the FILESTREAM file group entirely, ensuring you add the file immediately after creating the group in the same transaction batch to avoid an empty-group state.