diff --git a/hercules_opt/src/pass.rs b/hercules_opt/src/pass.rs
index 82adfeb5b3097336e3b1dd6451e3686fd2c1ea4d..2aa25a3456393397352cd3b69c576646fd806ecf 100644
--- a/hercules_opt/src/pass.rs
+++ b/hercules_opt/src/pass.rs
@@ -700,6 +700,8 @@ impl PassManager {
 
                     self.fix_deleted_functions(&new_idx);
                     self.clear_analyses();
+
+                    assert!(self.module.functions.len() > 0, "PANIC: There are no entry functions in the Hercules module being compiled, and they all got deleted by DeleteUncalled. Please mark at least one function as an entry!");
                 }
                 Pass::Verify => {
                     let (
diff --git a/juno_samples/cava.jn b/juno_samples/cava.jn
index ee46e47610bdc0ad324cbbf2c34d482fdbe0d25b..977e2e02c5ca7ea75dfe6a1b4ef99543a0d23dd3 100644
--- a/juno_samples/cava.jn
+++ b/juno_samples/cava.jn
@@ -205,6 +205,7 @@ fn tone_map<row : usize, col:usize>
   return result;
 }
 
+#[entry]
 fn cava<r, c : usize>(input : u8[CHAN, r, c], TsTw : f32[CHAN, CHAN],
                       ctrl_pts : f32[CTRL_PTS, CHAN],
                       weights : f32[CTRL_PTS, CHAN],