diff --git a/pyNastran/dev/bdf_vectorized3/cards/elements/mass.py b/pyNastran/dev/bdf_vectorized3/cards/elements/mass.py index 85507cff8..8e08a940c 100644 --- a/pyNastran/dev/bdf_vectorized3/cards/elements/mass.py +++ b/pyNastran/dev/bdf_vectorized3/cards/elements/mass.py @@ -573,7 +573,16 @@ def centroid(self) -> np.ndarray: nid = self.model.grid.node_id xyz = self.model.grid.xyz_cid0() inode = np.searchsorted(nid, self.node_id) - assert np.array_equal(nid[inode], self.node_id) + try: + assert np.array_equal(nid[inode], self.node_id) + except IndexError: # pragma: no cover + msg = ( + 'Invalid index in nid[inode]:\n' + f'nid={nid} ' + f'self.node_id={self.node_id} ' + f'inode={inode}' + ) + raise IndexError(msg) centroid = xyz[inode, :] + self.xyz_offset # handle cid=-1