I'd have to look at the code in more detail, but the packet checks are only approximate. There are several instructions that are not checked against resource availability, so adding them may indeed exceed the packet size limit.
The precise checks are a lot more complex. One thing to keep track of are "constant extenders", which are special instructions that only hold immediate values for operands that wouldn't otherwise fit in the encoding of the instruction that uses them.