~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix: sanitize exception messages to prevent information exposure
LearningCircuit1108b62c43a3
diff --git a/src/local_deep_research/advanced_search_system/answer_decoding/browsecomp_answer_decoder.py b/src/local_deep_research/advanced_search_system/answer_decoding/browsecomp_answer_decoder.pyindex ccb3c61ea4..581935334d 100644--- a/src/local_deep_research/advanced_search_system/answer_decoding/browsecomp_answer_decoder.py+++ b/src/local_deep_research/advanced_search_system/answer_decoding/browsecomp_answer_decoder.py@@ -413,7 +413,10 @@ class BrowseCompAnswerDecoder:"valid": is_valid,"length": len(decoded) if decoded else 0,}- except Exception as e:- analysis["attempted_decodings"][scheme] = {"error": str(e)}+ except Exception:+ logger.exception(f"Error decoding with scheme {scheme}")+ analysis["attempted_decodings"][scheme] = {+ "error": "Decoding failed"+ }return analysisdiff --git a/src/local_deep_research/advanced_search_system/strategies/browsecomp_entity_strategy.py b/src/local_deep_research/advanced_search_system/strategies/browsecomp_entity_strategy.pyindex 79e062be1a..bd4a10a692 100644--- a/src/local_deep_research/advanced_search_system/strategies/browsecomp_entity_strategy.py+++ b/src/local_deep_research/advanced_search_system/strategies/browsecomp_entity_strategy.py@@ -311,9 +311,9 @@ class BrowseCompEntityStrategy(BaseSearchStrategy):return answer, metadata- except Exception as e:+ except Exception:logger.exception("Error in BrowseComp entity search")- return f"Search failed: {e!s}", {"error": str(e)}+ return "Search failed", {"error": "Search failed"}def _identify_entity_type(self, query: str) -> str:"""Identify what type of entity we're looking for."""diff --git a/src/local_deep_research/advanced_search_system/strategies/focused_iteration_strategy.py b/src/local_deep_research/advanced_search_system/strategies/focused_iteration_strategy.pyindex 2895a656e7..1c4bd84149 100644--- a/src/local_deep_research/advanced_search_system/strategies/focused_iteration_strategy.py+++ b/src/local_deep_research/advanced_search_system/strategies/focused_iteration_strategy.py@@ -363,7 +363,7 @@ class FocusedIterationStrategy(BaseSearchStrategy):import tracebacklogger.exception(traceback.format_exc())- return self._create_error_response(str(e))+ return self._create_error_response("Search iteration failed")def _execute_parallel_searches(self, queries: List[str]) -> List[Dict]:"""Execute searches in parallel (like source-based strategy)."""@@ -382,7 +382,7 @@ class FocusedIterationStrategy(BaseSearchStrategy):return {"question": q, "results": result or []}except Exception as e:logger.exception(f"Error searching '{q}': {e!s}")- return {"question": q, "results": [], "error": str(e)}+ return {"question": q, "results": [], "error": "Search failed"}# Create context-preserving wrapper for the search functioncontext_aware_search = preserve_research_context(search_question)@@ -457,19 +457,19 @@ class FocusedIterationStrategy(BaseSearchStrategy):completed_searches += 1logger.exception(f"Error searching '{q}': {e!s}")self._update_progress(- f"Search failed for '{q[:30]}{'...' if len(q) > 30 else ''}': {str(e)[:50]}",+ f"Search failed for '{q[:30]}{'...' if len(q) > 30 else ''}'",None,{"phase": f"iteration_{iteration}_search_error","failed_query": q,- "error": str(e)[:100],+ "error": "Search error","search_progress": f"{completed_searches}/{total_searches}",},)return {"question": q,"results": [],- "error": str(e),+ "error": "Search failed","result_count": 0,}diff --git a/src/local_deep_research/advanced_search_system/strategies/llm_driven_modular_strategy.py b/src/local_deep_research/advanced_search_system/strategies/llm_driven_modular_strategy.pyindex cc6836f77f..eb85bed7a0 100644--- a/src/local_deep_research/advanced_search_system/strategies/llm_driven_modular_strategy.py+++ b/src/local_deep_research/advanced_search_system/strategies/llm_driven_modular_strategy.py@@ -778,12 +778,12 @@ class LLMDrivenModularStrategy(BaseSearchStrategy):return answer, metadata- except Exception as e:+ except Exception:logger.exception("Error in LLM-driven search")import tracebacklogger.exception(f"Traceback: {traceback.format_exc()}")- return f"Search failed: {e!s}", {"error": str(e)}+ return "Search failed", {"error": "Search failed"}async def _generate_final_answer(self, query, best_candidate, constraints):"""Generate comprehensive final answer"""diff --git a/src/local_deep_research/advanced_search_system/strategies/modular_strategy.py b/src/local_deep_research/advanced_search_system/strategies/modular_strategy.pyindex c865bdee14..3c133a340f 100644--- a/src/local_deep_research/advanced_search_system/strategies/modular_strategy.py+++ b/src/local_deep_research/advanced_search_system/strategies/modular_strategy.py@@ -782,9 +782,9 @@ class ModularStrategy(BaseSearchStrategy):return answer, metadata- except Exception as e:+ except Exception:logger.exception("💥 Error in enhanced modular search")- return f"Search failed: {e!s}", {"error": str(e)}+ return "Search failed", {"error": "Search failed"}async def _generate_final_answer(self, query: str, best_candidate, constraintsdiff --git a/src/local_deep_research/advanced_search_system/strategies/parallel_search_strategy.py b/src/local_deep_research/advanced_search_system/strategies/parallel_search_strategy.pyindex 90d60d9943..180860f660 100644--- a/src/local_deep_research/advanced_search_system/strategies/parallel_search_strategy.py+++ b/src/local_deep_research/advanced_search_system/strategies/parallel_search_strategy.py@@ -231,9 +231,13 @@ class ParallelSearchStrategy(BaseSearchStrategy):try:result = self.search.run(q)return {"question": q, "results": result or []}- except Exception as e:+ except Exception:logger.exception(f"Error searching for '{q}'")- return {"question": q, "results": [], "error": str(e)}+ return {+ "question": q,+ "results": [],+ "error": "Search failed",+ }# Run searches in parallelwith concurrent.futures.ThreadPoolExecutor(diff --git a/src/local_deep_research/advanced_search_system/strategies/rapid_search_strategy.py b/src/local_deep_research/advanced_search_system/strategies/rapid_search_strategy.pyindex 3523384110..164dfe24c4 100644--- a/src/local_deep_research/advanced_search_system/strategies/rapid_search_strategy.py+++ b/src/local_deep_research/advanced_search_system/strategies/rapid_search_strategy.py@@ -125,10 +125,13 @@ class RapidSearchStrategy(BaseSearchStrategy):# No findings added here - just collecting dataexcept Exception as e:- error_msg = f"Error during initial search: {e!s}"- logger.exception(f"SEARCH ERROR: {error_msg}")+ logger.exception(+ f"SEARCH ERROR: Error during initial search: {e!s}"+ )self._update_progress(- error_msg, 15, {"phase": "search_error", "error": str(e)}+ "Error during initial search",+ 15,+ {"phase": "search_error", "error": "Search error"},)initial_results = []@@ -201,12 +204,11 @@ class RapidSearchStrategy(BaseSearchStrategy):# No findings added here - just collecting dataexcept Exception as e:- error_msg = f"Error during search: {e!s}"- logger.exception(f"SEARCH ERROR: {error_msg}")+ logger.exception(f"SEARCH ERROR: Error during search: {e!s}")self._update_progress(- error_msg,+ "Error during search",int(question_progress + 2),- {"phase": "search_error", "error": str(e)},+ {"phase": "search_error", "error": "Search error"},)# Step 4: Perform a single final synthesis with all collected snippets using the citation handlerdiff --git a/src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py b/src/local_deep_research/advanced_search_system/strategies/source_based_strategy.pyindex 209d67c327..0c28b87914 100644--- a/src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py+++ b/src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py@@ -278,7 +278,11 @@ class SourceBasedSearchStrategy(BaseSearchStrategy):return {"question": q, "results": result or []}except Exception as e:logger.exception(f"Error searching for '{q}': {e!s}")- return {"question": q, "results": [], "error": str(e)}+ return {+ "question": q,+ "results": [],+ "error": "Search failed",+ }# Run searches in parallelwith concurrent.futures.ThreadPoolExecutor(diff --git a/src/local_deep_research/domain_classifier/classifier.py b/src/local_deep_research/domain_classifier/classifier.pyindex f778a1e1ce..05211147e3 100644--- a/src/local_deep_research/domain_classifier/classifier.py+++ b/src/local_deep_research/domain_classifier/classifier.py@@ -385,14 +385,14 @@ JSON Response:"""f"Failed to classify domain {domain}")- except Exception as e:+ except Exception:logger.exception(f"Error classifying domain {domain}")results["failed"] += 1results["domains"].append({"domain": domain,"status": "failed",- "error": str(e),+ "error": "Classification failed",})@@ -401,9 +401,9 @@ JSON Response:""")return results- except Exception as e:+ except Exception:logger.exception("Error in classify_all_domains")- results["error"] = str(e)+ results["error"] = "Classification failed"return resultsdef get_classification(self, domain: str) -> Optional[DomainClassification]:diff --git a/src/local_deep_research/metrics/pricing/cost_calculator.py b/src/local_deep_research/metrics/pricing/cost_calculator.pyindex 475451bab9..e5412a1f08 100644--- a/src/local_deep_research/metrics/pricing/cost_calculator.py+++ b/src/local_deep_research/metrics/pricing/cost_calculator.py@@ -134,7 +134,7 @@ class CostCalculator:"prompt_cost": 0.0,"completion_cost": 0.0,"total_cost": 0.0,- "error": str(e),+ "error": "Cost calculation failed",})diff --git a/src/local_deep_research/news/recommender/base_recommender.py b/src/local_deep_research/news/recommender/base_recommender.pyindex e64477976e..f6869ffdcc 100644--- a/src/local_deep_research/news/recommender/base_recommender.py+++ b/src/local_deep_research/news/recommender/base_recommender.py@@ -114,9 +114,9 @@ class BaseRecommender(ABC):results = self.search_system.analyze_topic(query)return results- except Exception as e:+ except Exception:logger.exception("Error executing search for recommendations")- return {"error": str(e)}+ return {"error": "Recommendation search failed"}def _filter_by_preferences(self, cards: List[NewsCard], preferences: Dict[str, Any]diff --git a/src/local_deep_research/research_library/deletion/services/collection_deletion.py b/src/local_deep_research/research_library/deletion/services/collection_deletion.pyindex af50f95abe..14901aafdb 100644--- a/src/local_deep_research/research_library/deletion/services/collection_deletion.py+++ b/src/local_deep_research/research_library/deletion/services/collection_deletion.py@@ -168,13 +168,13 @@ class CollectionDeletionService:return result- except Exception as e:+ except Exception:logger.exception(f"Failed to delete collection {collection_id}")session.rollback()return {"deleted": False,"collection_id": collection_id,- "error": str(e),+ "error": "Failed to delete collection",}def delete_collection_index_only(@@ -254,7 +254,7 @@ class CollectionDeletionService:return result- except Exception as e:+ except Exception:logger.exception(f"Failed to delete index for collection {collection_id}")@@ -262,7 +262,7 @@ class CollectionDeletionService:return {"deleted": False,"collection_id": collection_id,- "error": str(e),+ "error": "Failed to delete collection index",}def get_deletion_preview(self, collection_id: str) -> Dict[str, Any]:diff --git a/src/local_deep_research/research_library/deletion/services/document_deletion.py b/src/local_deep_research/research_library/deletion/services/document_deletion.pyindex 5180d5dd06..7eeec08cef 100644--- a/src/local_deep_research/research_library/deletion/services/document_deletion.py+++ b/src/local_deep_research/research_library/deletion/services/document_deletion.py@@ -136,13 +136,13 @@ class DocumentDeletionService:return result- except Exception as e:+ except Exception:logger.exception(f"Failed to delete document {document_id}")session.rollback()return {"deleted": False,"document_id": document_id,- "error": str(e),+ "error": "Failed to delete document",}def delete_blob_only(self, document_id: str) -> Dict[str, Any]:@@ -231,7 +231,7 @@ class DocumentDeletionService:return result- except Exception as e:+ except Exception:logger.exception(f"Failed to delete blob for document {document_id}")@@ -240,7 +240,7 @@ class DocumentDeletionService:"deleted": False,"document_id": document_id,"bytes_freed": 0,- "error": str(e),+ "error": "Failed to delete document blob",}def remove_from_collection(@@ -372,7 +372,7 @@ class DocumentDeletionService:return result- except Exception as e:+ except Exception:logger.exception(f"Failed to remove document {document_id} "f"from collection {collection_id}"@@ -383,7 +383,7 @@ class DocumentDeletionService:"document_deleted": False,"document_id": document_id,"collection_id": collection_id,- "error": str(e),+ "error": "Failed to remove document from collection",}def get_deletion_preview(self, document_id: str) -> Dict[str, Any]:diff --git a/src/local_deep_research/utilities/es_utils.py b/src/local_deep_research/utilities/es_utils.pyindex c5a000e8e3..63c145119d 100644--- a/src/local_deep_research/utilities/es_utils.py+++ b/src/local_deep_research/utilities/es_utils.py@@ -443,4 +443,4 @@ class ElasticsearchManager:except Exception as e:logger.exception(f"Error searching index '{index_name}': {e!s}")- return {"error": str(e)}+ return {"error": "Search failed"}diff --git a/src/local_deep_research/utilities/search_cache.py b/src/local_deep_research/utilities/search_cache.pyindex 7eb1a10133..41af753680 100644--- a/src/local_deep_research/utilities/search_cache.py+++ b/src/local_deep_research/utilities/search_cache.py@@ -475,9 +475,9 @@ class SearchCache:),}- except Exception as e:+ except Exception:logger.exception("Failed to get cache stats")- return {"error": str(e)}+ return {"error": "Cache stats unavailable"}# Global cache instancediff --git a/src/local_deep_research/web_search_engines/engines/parallel_search_engine.py b/src/local_deep_research/web_search_engines/engines/parallel_search_engine.pyindex 44acc0a363..2b613567f4 100644--- a/src/local_deep_research/web_search_engines/engines/parallel_search_engine.py+++ b/src/local_deep_research/web_search_engines/engines/parallel_search_engine.py@@ -554,12 +554,12 @@ Select up to {self.max_engines_to_select} engines that would best answer this qu"results": [],}- except Exception as e:+ except Exception:logger.exception(f"Error executing {engine_name}")return {"engine": engine_name,"success": False,- "error": str(e),+ "error": f"Engine {engine_name} failed","results": [],}@@ -652,12 +652,12 @@ Select up to {self.max_engines_to_select} engines that would best answer this quexcept Exception:logger.debug("Socket emit error (non-critical)")- except Exception as e:+ except Exception:logger.exception(f"Failed to get result from {engine_name}")engine_results[engine_name] = {"engine": engine_name,"success": False,- "error": str(e),+ "error": "Search execution failed","results": [],}