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: replace bare except clauses with specific exceptions in web routes (#2013)

LearningCircuitf3feeaf61708
diff --git a/src/local_deep_research/research_library/routes/library_routes.py b/src/local_deep_research/research_library/routes/library_routes.py
index b77eae043a..cee5456205 100644
--- a/src/local_deep_research/research_library/routes/library_routes.py
+++ b/src/local_deep_research/research_library/routes/library_routes.py
@@ -1248,7 +1248,8 @@ def get_research_sources(research_id):
from urllib.parse import urlparse
domain = urlparse(resource.url).hostname or ""
- except:
+ except ValueError:
+ # urlparse can raise ValueError for malformed URLs
pass
source_data = {
diff --git a/src/local_deep_research/web/routes/history_routes.py b/src/local_deep_research/web/routes/history_routes.py
index 7abc68cc7c..7658c064af 100644
--- a/src/local_deep_research/web/routes/history_routes.py
+++ b/src/local_deep_research/web/routes/history_routes.py
@@ -80,7 +80,7 @@ def get_history():
try:
metadata = json.loads(item["research_meta"])
item["metadata"] = metadata
- except:
+ except json.JSONDecodeError:
item["metadata"] = {}
# Ensure timestamps are in ISO format
diff --git a/src/local_deep_research/web/routes/metrics_routes.py b/src/local_deep_research/web/routes/metrics_routes.py
index 2096d66afb..e8d59cc3c9 100644
--- a/src/local_deep_research/web/routes/metrics_routes.py
+++ b/src/local_deep_research/web/routes/metrics_routes.py
@@ -1105,8 +1105,8 @@ def api_research_link_metrics(research_id):
category_counts["Unclassified"] = (
category_counts.get("Unclassified", 0) + 1
)
- except:
- pass
+ except Exception as e:
+ logger.debug(f"Error classifying domain {domain}: {e}")
# Sort domains by count
sorted_domains = sorted(
@@ -2172,7 +2172,8 @@ def api_classification_progress():
domain = domain[4:]
if domain:
domains.add(domain)
- except:
+ except ValueError:
+ # urlparse can raise ValueError for malformed URLs
continue
all_domains = sorted(list(domains))