diff --git a/scripts/check_site.lua b/scripts/check_site.lua
index b5bcd5f2b34cb4a6fc95cde73d49b115bed39200..b268e0b31f7ecb5dae3164ec40239cdfed9b4779 100644
--- a/scripts/check_site.lua
+++ b/scripts/check_site.lua
@@ -217,8 +217,8 @@ end
 function need_alphanumeric_key(path)
 	local val = path[#path]
 	-- We don't use character classes like %w here to be independent of the locale
-	if not val:match('^[0-9a-zA-Z_]+$') then
-		var_error(path, val, 'have a key using only alphanumeric characters and underscores')
+	if type(val) ~= 'string' or not val:match('^[0-9a-zA-Z_]+$') then
+		var_error(path, val, 'have a string key using only alphanumeric characters and underscores')
 	end
 end