Fix state compiler stack trace, github issue #5767