The error XML contains multiple root elements which is not valid XML. Please fix the source data. means an HTTP export, import, or lookup read or sent an Extensible Markup Language (XML) body with more than one root element. integrator.io accepts only valid XML, and valid XML has exactly one root element that contains every other element. This article is for builders whose HTTP flow steps send or receive XML. It explains how to recognize the error, confirm the cause, and fix the payload.
Error symptoms
The flow step that reads or writes the XML body fails with this error:
XML contains multiple root elements which is not valid XML. Please fix the source data.
Only that step fails. The rest of the flow continues to run when it can.
Error cause
Valid XML has exactly one root element, and every other element sits inside it. When two or more elements sit side by side at the top level, the payload isn't valid XML, so integrator.io stops the step instead of processing it. integrator.io has no setting that accepts XML with more than one root element, so you have to fix the payload itself.
Confirm the cause
Note: To view runs and errors, you need at least monitor access to the integration: Monitor all at the account level, or Monitor for that integration. For details, see Manage user roles & permissions to an account.
- Find the failed run on the Dashboard, or in the flow's Run console or Run history. For details, see Monitor errors.
- On the step that failed, select the error count to open the Errors page.
- Review the XML body for that step.
- Check whether two or more elements sit at the top level with nothing wrapping them.
Valid: One root element wraps everything.
<response>
<customer>
<id>123</id>
</customer>
<order>
<id>456</id>
</order>
</response>
Invalid: More than one top-level element.
<customer> <id>123</id> </customer> <order> <id>456</id> </order>
Fix the error
Ask the owner of the system that sends the XML to wrap the body in one parent element, for example <response>, so that every other element sits inside it. If you own that system, update it yourself.
Prevent the error
When you set up an HTTP export or lookup against an XML API, confirm the response has one root element before you schedule the flow.