diff --git a/src/html/search.rs b/src/html/search.rs
index dd2ad0bf..884bd614 100644
--- a/src/html/search.rs
+++ b/src/html/search.rs
@@ -34,7 +34,9 @@ fn doc_nodes_into_search_index_node(
super::util::all_deprecated(&doc_nodes.iter().collect::>());
let mut location = doc_nodes[0].location.clone();
- let location_url = ModuleSpecifier::parse(&location.filename).unwrap();
+ let Ok(location_url) = ModuleSpecifier::parse(&location.filename) else {
+ return vec![];
+ };
location.filename = if let Some(short_path) = ctx
.doc_nodes
.keys()