Not really your fault, but I think raising an explicit and usefully named error would be better than an assertion error here.