What does Windows error code 1465 (ERROR_XML_PARSE_ERROR) mean?

 
Previous Next
ERROR_SYMLINK_NOT_SUPPORTED ERROR_XMLDSIG_ERROR

ERROR_XML_PARSE_ERROR

The requested XML data is not well-formed or cannot be parsed.

ERROR_XML_PARSE_ERROR is Win32 error 1465 (0x5B9). It is a general Windows error used when a component cannot parse XML input. The constant does not identify the parser, document type, schema, or offending line; those details must be obtained from the originating API, component log, or parser-specific error interface.

Common causes

  • an unescaped ampersand, angle bracket, or quote in text or attributes
  • mismatched, missing, or incorrectly nested element tags
  • invalid byte encoding or a declaration that disagrees with the actual bytes
  • truncated input from a file, registry value, network response, or IPC message
  • unexpected namespaces, entities, or document structure for the consuming component

Evidence to preserve safely

Record the producer, parser or API, input length, content type, declared encoding, line and column if available, parser-specific code, schema or document version, and a cryptographic hash of the original bytes. Preserve a redacted copy of the exact failing input; reserializing it can hide encoding and truncation defects. Remove credentials and personal data before attaching XML to logs.

Diagnostic sequence

Validate well-formedness with a parser that reports location while keeping the original byte stream. Inspect the first parser error rather than later cascading messages. Compare declared and detected encoding, check for a byte-order mark, and verify that the transport did not cut the document at a buffer or message boundary.

If the XML is well-formed, inspect component-specific expectations: required root element, namespaces, allowed elements, schema version, and signature placement. Error 1465 can be surfaced by a Windows component that rejects structure beyond basic XML grammar, so the component’s own diagnostics remain authoritative.

Developer guidance

Generate XML through a writer or DOM API instead of string concatenation, validate external documents before use, impose size and entity-expansion limits, and include deterministic version information. Treat XML as untrusted input. Avoid enabling external entity resolution unless the application explicitly requires and secures it.

Recovery

Regenerate the document from authoritative data, fix the producer, or restore a known-good configuration. Retrying the identical bytes will not repair a deterministic syntax error. When input was truncated in transit, correct framing and verify the complete length before parsing again.

Difference from XML signature errors

ERROR_XMLDSIG_ERROR concerns processing an XML digital signature after or during XML handling. Error 1465 is the broader parse failure and can occur before signature validation is possible.

Example

A service writes configuration XML by concatenating an account display name into an attribute. A name containing & is not escaped, and the next startup returns 1465. Using an XML writer produces the proper entity and prevents malformed configuration.

References


Looking for a different code? Search another status or error code.