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: Use Unauthorized exception instead of ValueError for missing Flask session

LearningCircuita1bb2f9a008f
diff --git a/src/local_deep_research/database/thread_metrics.py b/src/local_deep_research/database/thread_metrics.py
index 4d3174fd64..05eda4cb94 100644
--- a/src/local_deep_research/database/thread_metrics.py
+++ b/src/local_deep_research/database/thread_metrics.py
@@ -54,10 +54,11 @@ class ThreadSafeMetricsWriter:
if username is None:
try:
from flask import session as flask_session
+ from werkzeug.exceptions import Unauthorized
username = flask_session.get("username")
if not username:
- raise ValueError("No username in Flask session")
+ raise Unauthorized("No username in Flask session")
except (ImportError, RuntimeError) as e:
# Flask context not available or no session
raise ValueError(f"Cannot determine username: {e}")