Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: fail validation for invalid model file extensions (#1923)

LearningCircuit3a20326a5671
diff --git a/src/local_deep_research/config/llm_config.py b/src/local_deep_research/config/llm_config.py
index 200653c4ca..b16f38bca0 100644
--- a/src/local_deep_research/config/llm_config.py
+++ b/src/local_deep_research/config/llm_config.py
@@ -920,12 +920,13 @@ def get_llm(
model_path = str(validated_path)
- # Check for .gguf extension (warning only, don't block)
+ # Validate file extension - LlamaCpp requires .gguf or .bin files
# Safe to use validated_path here since it passed security validation
if validated_path.suffix.lower() not in (".gguf", ".bin"):
- logger.warning(
- f"Model file does not have .gguf extension: {validated_path.suffix}. "
- "LlamaCpp typically expects .gguf files."
+ raise ValueError(
+ f"Invalid model file extension: {validated_path.suffix}\n"
+ f"LlamaCpp requires .gguf or .bin model files.\n"
+ f"File: {validated_path.name}"
)
# Get additional LlamaCpp parameters
diff --git a/tests/config/test_llm_config_providers.py b/tests/config/test_llm_config_providers.py
index ad86d6d395..cddcd0cd7f 100644
--- a/tests/config/test_llm_config_providers.py
+++ b/tests/config/test_llm_config_providers.py
@@ -117,6 +117,34 @@ class TestProviderInstantiation:
assert is_valid
+ def test_llamacpp_rejects_invalid_extension(self):
+ """LlamaCpp rejects model files without .gguf or .bin extension."""
+ import tempfile
+ from pathlib import Path
+ from unittest.mock import patch
+
+ with tempfile.TemporaryDirectory() as tmpdir:
+ # Create a file with invalid extension
+ bad_model = Path(tmpdir) / "model.txt"
+ bad_model.write_text("not a real model")
+
+ with (
+ patch(
+ "local_deep_research.config.llm_config.get_setting_from_snapshot",
+ side_effect=lambda key, *a, **kw: str(bad_model)
+ if "model_path" in key
+ else None,
+ ),
+ patch(
+ "local_deep_research.security.path_validator.PathValidator.validate_model_path",
+ return_value=bad_model,
+ ),
+ pytest.raises(ValueError, match="Invalid model file extension"),
+ ):
+ from local_deep_research.config.llm_config import get_llm
+
+ get_llm(provider="llamacpp")
+
def test_llamacpp_gpu_layers_config(self):
"""LlamaCpp GPU layers configuration."""
n_gpu_layers = 35 # Number of layers to offload to GPU