It would probably help if you could post a minimal example of the code that reproduces the error.
If you can’t do that, can you identify the point of crashing in a particular rule in your objective generation rulebook? Can you pinpoint it to a particular line of that rule? That also would probably help.