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

Troubleshooting Guide: SQL Server Error 2293 – “Choice cannot be empty unless minOccurs is 0”

Why This Error Happens

Error 2293 typically occurs when SQL Server attempts to parse an XML schema collection (XSD) or an XML-based configuration file (such as a Policy-Based Management policy, SSIS package manifest, or Report Definition Language file) that contains a malformed <xs:choice> element lacking any child particles. This is often caused by a corrupted or incompletely written XML file, a botched upgrade/migration process that truncated schema definitions, or manual edits to system XML metadata that violate the W3C XML Schema structural rules. Because SQL Server 2025 enforces stricter schema validation against XSD definitions during startup and query execution, even a single empty <xs:choice> block will trigger a hard parsing failure at the location specified in the error message.

Step-by-Step Resolution Guide

Step 1: Identify the Exact XML Source Causing the Failure

  • Open the SQL Server Error Log via SQL Server Management Studio (SSMS) or navigate to C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG.
  • Locate the full error text, paying close attention to the Location: '%ls' value, which points to the specific XML namespace or file path.
  • Cross-reference the location string with known XML schema collections using the query: SELECT * FROM sys.xml_schema_collections;

Step 2: Validate and Repair the XML Schema File

  • Extract the suspect schema using: SELECT xml_schema_namespace('dbo','YourSchemaCollectionName');
  • Open the extracted XML in Visual Studio 2022+ or a dedicated XML editor and run XML > Validate to pinpoint the broken <xs:choice> block.
  • Manually correct the schema by either adding required child elements inside <xs:choice> or explicitly setting minOccurs="0" if the choice is intentionally optional.
  • Re-import the corrected schema using CREATE XML SCHEMA COLLECTION or ALTER XML SCHEMA COLLECTION.

Step 3: Check for Corrupted Installation or Configuration Files

  • Navigate to C:\Program Files\Microsoft SQL Server\170\Shared\ and inspect any .xsd files tied to Policy-Based Management or Replication components.
  • Run sfc /scannow from an elevated Command Prompt on Windows Server 2025 to rule out OS-level file corruption affecting shared XML parser libraries (msxml6.dll).
  • If the issue stems from a recent SQL Server Cumulative Update, reapply the latest CU package from the Microsoft Download Center to restore clean baseline XML definitions.

Step 4: Rebuild Affected SSIS Packages or Reports (If Applicable)

  • If the error originates from an SSIS package (.dtsx) or SSRS report (.rdl), open the file in SQL Server Data Tools (SSDT) and check the underlying XML via a text editor for stray <xs:choice> tags.
  • Remove or reconfigure any custom XML schema references embedded in the package’s connection manager or data flow components.
  • Redeploy the corrected package to the SSIS Catalog or Report Server.

Alternative or Verification Steps

  • Verify the fix by restarting the SQL Server service (net stop MSSQLSERVER && net start MSSQLSERVER) and confirming the ERRORLOG no longer reports Event ID 2293 on startup.
  • If the problem persists, restore the affected database or msdb system database from a last-known-good backup taken prior to the schema corruption, then reapply any schema changes incrementally while validating XML syntax at each step.