Material Function Reentrant Expression error

I’m making a scene that requires very high resolution texture maps. To do this, I’m using a material function to stitch multiple textures together, remapping them to 0-1 UVs. This works, but my issue is when I start applying parallax mapping using the BumpOffset function. My material function takes two textures and a UV mapping, and stitches them into a single texture across the X axis:

As you can see from the previews, this works, but it produces problems when used twice in succession, as is necessary for heightmaps:

Note the error - reentrant expression. As far as I understand it, this means there is some kind of expression that feeds back into itself, and may not terminate, but this graph is essentially two function calls. Assuming both of those terminate (which they must), two calls to it must also terminate (a standard, provable logic identity).

Could someone tell me why I can’t use this function twice like this? What is the problem, and why does Unreal seem to think this could possibly not terminate?

I think this is a bug, we have an issue like this in the database, however it has proved difficult to fix without breaking other things. Sorry about that. Maybe you can find a workaround?

Ah, thanks for clearing that up. The workaround I’ve found just uses two very similar material functions, and as long as I don’t use the same one twice within the same flow (though I can use the same one twice on different branches, which given the nature of the error makes sense) then I have no problems.

It did eventually turn out that I didn’t even need to do this, though, as I hit sampler limits after about 12 samplers (not sure where the first 4 went, though), and had to dial back the resolution to cut down on stitching. The heightmaps were some of these, as the lower resolution is not immediately noticeable.