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

Troubleshooting Guide: SQL Server Error 13113 (Schema Issue)

Why This Error Happens

Error 13113 in Microsoft SQL Server 2025 typically occurs when the Service Broker or JSON/XML schema validation component encounters a mismatch between the expected schema definition and the actual data contract being processed. This is most commonly caused by corrupted schema collection metadata in the system catalog, insufficient permissions on the sys.xml_schema_collections object, or a conflict introduced during a recent migration/upgrade from a prior SQL Server version to the 2025 engine. In some cases, this error also surfaces when Windows Server 2025 security policies block the service account from accessing schema-related temp files.

Step-by-Step Resolution Guide

Step 1: Verify Service Account Permissions

  • Open SQL Server Configuration Manager and confirm the service account running the SQL Server (MSSQLSERVER) instance.
  • Ensure this account has db_ddladmin or higher rights on the affected database.
  • Run the following T-SQL to check current permissions:
  SELECT * FROM fn_my_permissions(NULL, 'DATABASE');
  • Grant missing permissions using:
  ALTER ROLE db_ddladmin ADD MEMBER [YourServiceAccount];

Step 2: Validate and Rebuild the Schema Collection

  • Identify the broken schema collection causing the conflict:
  SELECT * FROM sys.xml_schema_collections WHERE name = 'YourSchemaName';
  • Drop and recreate the corrupted schema collection:
  DROP XML SCHEMA COLLECTION YourSchemaName;
  • Re-import the correct schema definition file (.xsd) from your source repository.

Step 3: Check Windows Server 2025 Security and File Access

  • Navigate to C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\ and confirm the SQL Server service account has Modify permissions.
  • Temporarily disable Windows Defender Controlled Folder Access for this directory to rule out interference:
  • Go to Windows Security > Virus & threat protection > Manage ransomware protection.
  • Restart the SQL Server service via PowerShell:
  Restart-Service -Name 'MSSQLSERVER' -Force

Step 4: Run Database Consistency Check

  • Execute a full integrity check to rule out underlying corruption:
  DBCC CHECKDB('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Review the output log for any schema-related corruption flags before proceeding further.

Alternative or Verification Steps

  • To verify the fix, re-run the original operation that triggered Error 13113 and confirm no error is logged in SQL Server Error Log or Windows Event Viewer (under Applications and Services Logs > MSSQLSERVER).
  • If the issue persists, restore the affected database from the most recent known-good backup and re-apply schema changes incrementally to isolate the faulty definition.