In addition to the grounds for dismissal of an indictment specified in rules 17.06, subdivision 2, and 18.09, subdivision 2, of the Rules of Criminal Procedure and subject to the provisions of rules 17.06, subdivision 1, and 31.01, of the Rules of Criminal Procedure, the indictment shall be dismissed by the court in which the defendant is arraigned, upon the defendant's motion, in any of the following cases:
(2) when the names of the witnesses examined before the grand jury are not inserted at the foot of the indictment or endorsed thereon;
(3) when a person was permitted to be present at the session of the grand jury while the charge embraced in the indictment was under consideration, except as provided by section 628.63 and rule 18.03 of the Rules of Criminal Procedure;
(4) when the grand jury by which the indictment was found had no legal authority to inquire into the offense charged, by reason of the offense charged not being within the local jurisdiction of the county;
(6) when more than one offense is charged in the indictment, except in cases where it is allowed by statute;
(7) when the facts stated do not constitute a public offense; or
(8) when the indictment contains any matter which, if true, would constitute a legal justification or excuse of the offense charged, or other legal bar to the prosecution.
If the motion to dismiss the indictment is not made, the defendant shall be precluded from afterwards making any of the foregoing objections except that the objection to lack of jurisdiction specified in clause (4) and the objection of failure of the indictment to include facts stating a public offense specified in clause (7) shall be noticed by the court at any time during the pendency of a proceeding. Failure to include any objections constitutes a waiver thereof, but the court for good cause shown may, in accordance with rule 10.01, subdivision 2, of the Rules of Criminal Procedure, grant relief from the waiver.