diff --git a/aidge_core/export_utils/code_generation.py b/aidge_core/export_utils/code_generation.py
index 995df18b52d5701af5259d571e6a0a91a83ba665..4f0f4634dd8ac09c8c0a86506dc52d420889b22a 100644
--- a/aidge_core/export_utils/code_generation.py
+++ b/aidge_core/export_utils/code_generation.py
@@ -19,6 +19,8 @@ def generate_file(file_path: Union[Path, str], template_path: Union[Path, str],
         file_path = Path(file_path)
     if isinstance(template_path, str):
         template_path = Path(template_path)
+    if not template_path.exists():
+        raise ValueError(f"Path to template {template_path} is not valid !")
     # Make dir
     file_path.parent.mkdir(parents=True, exist_ok=True)