diff --git a/src/renderer/html_handlebars/search.rs b/src/renderer/html_handlebars/search.rs
index 8fcb501476..20f8748e94 100644
--- a/src/renderer/html_handlebars/search.rs
+++ b/src/renderer/html_handlebars/search.rs
@@ -263,7 +263,7 @@ pub fn create_files(
utils::fs::write_file(destination, "elasticlunr.min.js", searcher::ELASTICLUNR_JS)?;
#[cfg(feature = "search-non-english")]
if extra_language_subtag.is_some() {
- let language = language.expect("non-English index is only built when specified");
+ let language = potentially_supported_language.expect("non-English index is only built when specified");
utils::fs::write_file(
destination,
"lunr.stemmer.support.js",