diff --git a/scripts/contrib/improve_kernel_cve_report.py b/scripts/contrib/improve_kernel_cve_report.py
index 41cbc1e222..76ba54d835 100755
--- a/scripts/contrib/improve_kernel_cve_report.py
+++ b/scripts/contrib/improve_kernel_cve_report.py
@@ -252,8 +252,14 @@ def read_debugsources(file_path):
             # We need to remove one level from the debug sources
             for source_list in json_data.values():
                 for source in source_list:
+                    # entries are empty if the kernel has no debug info
+                    if "/" not in source:
+                        continue
                     src = source.split("/",1)[1]
                     cfiles.add(src)
+    if not cfiles:
+        sys.exit(f"{file_path} lists no compiled sources: "
+                 "is the kernel built without debug info (CONFIG_DEBUG_INFO)?")
     return cfiles
 
 def check_kernel_compiled_files(compiled_files, cve_info):
