Fix the serious error, even if it risks the deadline
I’d report it and fix it, even if it risks the deadline. An on‑time but wrong deliverable just creates a bigger mess later, so I’d loop in whoever needs to know and then focus on correcting it fast.