core/src/main/java/org/trimou/engine/parser/DefaultParsingHandler.java
private RootSegmentBase validate() {

        ContainerSegmentBase root = containerStack.peekFirst();

        if (!(root instanceof RootSegmentBase)) {
            throw new MustacheException(
                    MustacheProblem.COMPILE_INVALID_TEMPLATE,
                    "Incorrect last container segment on the stack: %s",
                    containerStack.peekFirst().toString(), line);
        }
        return (RootSegmentBase) root;
    }
private RootSegmentBase validate() {

        ContainerSegmentBase root = containerStack.peekFirst();

        if (!(root instanceof RootSegmentBase)) {
            throw new MustacheException(
                    MustacheProblem.COMPILE_INVALID_TEMPLATE,
                    "Incorrect last container segment on the stack: %s",
                    containerStack.peekFirst().toString(), line);
        }
        return (RootSegmentBase) root;
    }
Validate the compiled template.