Hey Tom,
I think it's an easy fix, even though the error message is a bit misleading. Since you've got two levels of package nesting in your second example, they both need to be numbered so the reporting engine can keep them separated. Try putting an integer on your first $repeatPackages (i.e., $repeatPackages0) and the matching $end, and that should work for you.
Jason