Workday errors in plain English.

Submit an Error

Splitter Raises WRONG_DOCUMENT_ERR Only When Not Stepping Through Debug

✓ Verified Workday Studio 4 lookups
The error WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it. Root Cause: org.w3c.dom.DOMException

What does "WRONG_DOCUMENT_ERR: A node is used in a different document" mean in Workday Studio?

A Splitter step is handing its sub route nodes that still belong to the XML document they were parsed from, and the DOM refuses to let a second document adopt them. It often looks like a debugger ghost, because pausing on a breakpoint changes when the message is materialised and can hide the problem entirely.

Quick fix

Insert a serialise and re-parse (or a Copy step that writes the node into a brand new message) as the first step inside the Splitter sub route, so every downstream step works on a node the new document owns.

Permanent fix

Treat anything a Splitter emits as read-only and owned by its source document. Build sub route output into a fresh message rather than grafting split nodes onto XML created elsewhere, and always run assemblies with all breakpoints removed before promoting, since debug pauses can mask node ownership faults.

Troubleshooting

  1. Confirm the failure is real rather than a debug artefact by running the assembly with no breakpoints at all, then again with a breakpoint on the Splitter sub route. If it only fails without the breakpoint, this is node ownership, not logic.
  2. Look at what the Splitter is iterating over. If the xpath-splitter strategy is pointed at the mediation context message rather than at the step input message, every node it emits is still owned by the context document.
  3. Inspect the first step inside the sub route. Any step that writes the split node into another message, or merges it with XML built elsewhere, is where the DOM will object.
  4. Add a Log step at the top of the sub route that prints the node as text. If the log succeeds and the next step fails, the node is readable but not adoptable, which confirms the diagnosis.
  5. Serialise the split node to a string and re-parse it into a fresh message before any step that combines it with other XML.
Was this helpful?

Related errors