~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(collections): validate collection type input (#5397)
Ziyang Guo30b00eb91986
diff --git a/changelog.d/+collection-type-validation.bugfix.md b/changelog.d/+collection-type-validation.bugfix.mdnew file mode 100644index 0000000000..8c62978d6c--- /dev/null+++ b/changelog.d/+collection-type-validation.bugfix.md@@ -0,0 +1 @@+Return a clear validation error when collection creation receives a non-string collection type.diff --git a/src/local_deep_research/research_library/routes/rag_routes.py b/src/local_deep_research/research_library/routes/rag_routes.pyindex b88f5bf378..e16a01a3af 100644--- a/src/local_deep_research/research_library/routes/rag_routes.py+++ b/src/local_deep_research/research_library/routes/rag_routes.py@@ -1388,6 +1388,13 @@ def create_collection():name = data.get("name", "").strip()description = data.get("description", "").strip()collection_type = data.get("type", "user_uploads")+ if not isinstance(collection_type, str):+ return jsonify(+ {+ "success": False,+ "error": "Collection type must be a string",+ }+ ), 400# Allowlist user-creatable types. System types (notes,# default_library, research_history) are lazy-created by their# owning subsystems; a user-crafted impostor (e.g. type="notes")diff --git a/tests/notes/test_notes_routes_review_fixes.py b/tests/notes/test_notes_routes_review_fixes.pyindex f60c9b4e2f..38261fdcd9 100644--- a/tests/notes/test_notes_routes_review_fixes.py+++ b/tests/notes/test_notes_routes_review_fixes.py@@ -1895,6 +1895,16 @@ class TestCreateCollectionTypeAllowlist:assert payload["success"] is Falseassert "type" in payload["error"].lower()+ @pytest.mark.parametrize("invalid_type", [[], {}])+ def test_rejects_unhashable_collection_types(self, invalid_type):+ status, payload = self._post_create(+ {"name": "Trap", "type": invalid_type}+ )++ assert status == 400+ assert payload["success"] is False+ assert "type must be a string" in payload["error"].lower()+def _post_create_accept(self, payload):"""Like _post_create but its fake session stamps created_at on add()so the success branch's collection.created_at.isoformat() doesn't