Well that's a classic Stack Overflow Error if I've ever seen on. Looks like you have a recursive layout loading issue, you should check for that. Bat as
@Cableguy said, a small example would help.
Or, you could export your code as a code bundle with the error message and screenshot directly into an AI, and see if the AI gives you the answer. That's what Erel created the code bundle for, to help developers with their issues.
I've not used code bundle for that though, but it should work for you. It it does work and you fix the issue, don't forget to post what the fix was.