This seems like a programmer error to me, in which case we should throw an exception or assert.