Throw an error if a type constraint is misplaced.