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

Troubleshooting Guide: SQL Server Error 9455 (XML Parsing Error)

Why This Error Happens

Error 9455 occurs when SQL Server’s internal XML parser encounters malformed, truncated, or invalid XML data during a parsing operation, such as a CONVERT, CAST, or OPENXML call. This typically stems from corrupted XML data stored in a column, improperly escaped special characters (like unencoded ampersands or angle brackets), or XML data that exceeds expected schema constraints. In some cases, the issue arises from a mismatch between the XML encoding declaration and the actual byte encoding of the data being passed to SQL Server 2025.

Step-by-Step Resolution Guide

Step 1: Identify the Exact Line and Source of the XML Error

  • Note the specific line number (%d) referenced in the error message to pinpoint the malformed section.
  • Run the failing query in SQL Server Management Studio (SSMS) with SET SHOWPLAN_XML OFF to isolate the offending statement.
  • Extract the raw XML value using SELECT xml_column FROM your_table WHERE id = 'problem_row' and inspect it in a text editor for broken tags or encoding issues.

Step 2: Validate and Repair the XML Structure

  • Check for unescaped special characters (&, <, >) that need to be converted to &amp;, &lt;, &gt;.
  • Use SELECT CAST(xml_column AS NVARCHAR(MAX)) to convert the XML to plain text for manual inspection before re-casting.
  • If the data originates from an external application, verify the source system is generating well-formed XML before insertion.

Step 3: Update SQL Server 2025 and Verify XML Schema Collections

  • Navigate to SQL Server Configuration Manager on Windows Server 2025 / Windows 11 and confirm you are running the latest Cumulative Update (CU) for SQL Server 2025, as XML parser bugs are frequently patched.
  • Check Windows Update (Settings > Windows Update) to ensure the underlying .NET Framework components used by the XML parser are current.
  • If using XML Schema Collections, run SELECT * FROM sys.xml_schema_collections to confirm the schema hasn’t been dropped or corrupted.

Step 4: Re-import or Re-insert Clean Data

  • Delete or update the corrupted row using a verified, well-formed XML payload.
  • If the issue stems from a bulk import (e.g., via BULK INSERT or SSIS), inspect the source file encoding (should be UTF-8 or UTF-16 as expected by the destination column).
  • Re-run the import job and monitor the SQL Server Error Log located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for recurrence.

Alternative or Verification Steps

  • Verify the fix by running SELECT CAST(xml_column AS XML) on the previously failing row; if no error is thrown, the data is now valid.
  • As an alternative, if the error persists on a specific schema-bound XML column, temporarily remove the XML schema collection binding using ALTER TABLE ... ALTER COLUMN xml_column XML(NULL) to isolate whether the schema itself is causing the rejection.