I am working in Apex 5.1.3, using the APEX Tree Region. I have a query which returns 30 records, with a total of 4 levels (Starting at 1). This query is a union of 5 tables to properly retrieve the necessary data. I am able to run this query in SQL Developer and the SQL Commands section of APEX with no issues. All of the parent Ids, levels, and Ids are populating correctly. When I put this query in the APEX Tree Region, I get a JS error where it seems like the JavaScript tree variable is not closing entirely. (Missing ']' and ')' elements).

I was able to get a simplified version working where I removed 2 unions in the main query (aka last 2 levels), but I could not pinpoint anything specific in those two queries that would cause a problem. I did try all queries within the unions separately, and they all appeared on the page correctly.
Any tips on where to look next or thoughts would be good!
Thanks.