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

Troubleshooting Guide: SQL Server Error 6393 — Duplicate Path Mapping in Selective XML Index

Why This Error Happens

Error 6393 occurs when a Selective XML Index (SXI) definition contains two or more path expressions that resolve to the exact same node path while also being mapped to identical XSD types. SQL Server 2025 enforces strict uniqueness on path-to-type mappings within a single selective XML index to avoid ambiguous promotion of XML node values into secondary indexes. This typically results from manually scripted CREATE XML INDEX or CREATE SELECTIVE XML INDEX / CREATE XML SELECTIVE INDEX statements where redundant WITH XMLNAMESPACES or path promotion clauses were copy-pasted without updating the path or the type binding, or from merging index definitions generated by different schema versions.

Step-by-Step Resolution Guide

Step 1: Review the Full Index Definition Script

  • Open the T-SQL script or use SSMS to script out the existing selective XML index via Right-click Index > Script Index as > CREATE To.
  • Locate the CREATE SELECTIVE XML INDEX statement and inspect every path promotion entry under the FOR clause.
  • Pay close attention to repeated sql:column, path expressions, and AS XQUERY / AS SQL type declarations.

Step 2: Identify the Duplicate Path/Type Pair

  • Compare each path expression (e.g., /Root/Customer/@id) listed in the index body against every other entry.
  • Check if two entries share the identical path string AND the identical XSD type (e.g., both mapped as xs:int).
  • Use a text diff tool or Ctrl+F in Query Editor against the script file to quickly spot exact string duplicates in the path list.
  • Example of the conflict pattern to search for:
PATHS (
    '/Root/Customer/@id' AS xs:int,
    '/Root/Customer/@id' AS xs:int  -- duplicate causes Error 6393
)

Step 3: Remove or Consolidate the Redundant Path Entry

  • Delete the duplicate line entirely if it is an exact redundant mapping.
  • If the two paths were meant to map to different types (e.g., one as xs:int and one as xs:string), correct the type on one entry instead of deleting it, since differing types are permitted.
  • Save the corrected script to a .sql file, e.g., C:\SQLScripts\Fix_SXI_Index.sql.

Step 4: Drop and Recreate the Selective XML Index

  • Run the following in SSMS or sqlcmd connected to your SQL Server 2025 instance:
DROP INDEX [SXI_YourIndexName] ON dbo.YourTable;
GO
-- Execute corrected CREATE SELECTIVE XML INDEX script
  • Confirm the instance service MSSQLSERVER (or named instance) is running under Windows Server 2025 / Windows 11 via Services.msc before executing, to avoid connection timeouts mid-script.

Step 5: Validate Index Creation Logs

  • Check SQL Server Error Log (C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for any residual warnings after re-creation.
  • Confirm no Error 6393 reappears during the CREATE SELECTIVE XML INDEX execution output.

Alternative or Verification Steps

  • Verify success by querying sys.selective_xml_index_paths and sys.xml_indexes to confirm only unique path/type combinations exist for the target index ID.
  • As an alternative, if the script was generated by a third-party ORM or schema migration tool, regenerate the index definition from a clean schema export rather than manually editing the existing (possibly corrupted) script.