HKUDS/DeepTutor · error · ValueError
Select at most one PageIndex OSS knowledge base per request.
Error message
Select at most one PageIndex OSS knowledge base per request. Selected: {', '.join(selected)} What it means
validate_pageindex_oss_selection enforces that at most one PageIndex OSS (self-hosted) knowledge base may participate in a single request, because the OSS SDK binding is a singleton per process. Passing two or more distinct OSS KB names raises ValueError listing the offenders.
Source
Thrown at deeptutor/services/rag/pipelines/pageindex/__init__.py:41
return None
def is_pageindex_kb(kb_name: str | None) -> bool:
from deeptutor.services.rag.factory import PAGEINDEX_OSS_PROVIDER, PAGEINDEX_PROVIDER
return _bound_pageindex_provider(kb_name) in {PAGEINDEX_PROVIDER, PAGEINDEX_OSS_PROVIDER}
def validate_pageindex_oss_selection(knowledge_bases: list[str]) -> None:
from deeptutor.services.rag.factory import PAGEINDEX_OSS_PROVIDER
selected = [
name
for name in dict.fromkeys(str(item or "").strip() for item in knowledge_bases)
if name and _bound_pageindex_provider(name) == PAGEINDEX_OSS_PROVIDER
]
if len(selected) > 1:
raise ValueError(
"Select at most one PageIndex OSS knowledge base per request. "
f"Selected: {', '.join(selected)}"
)
__all__ = ["PageIndexPipeline", "is_pageindex_kb", "validate_pageindex_oss_selection"]
View on GitHub (pinned to 3e82f13042)
Solutions
- Remove all but one PageIndex OSS KB from the request; merge their documents into a single OSS KB if both corpora are needed.
- If you need multiple corpora, use cloud PageIndex KBs alongside the single OSS one, or duplicate queries per OSS KB sequentially.
Example fix
# before await pipeline.explore(query=q, knowledge_bases=["oss-main", "oss-archive"]) # after await pipeline.explore(query=q, knowledge_bases=["oss-main", "cloud-kb"])
Defensive patterns
Strategy: validation
Validate before calling
from deeptutor.services.rag.pipelines.pageindex import validate_pageindex_oss_selection validate_pageindex_oss_selection(knowledge_bases) # raises before any network work
Type guard
def oss_kb_count(knowledge_bases: list[str]) -> int:
from deeptutor.services.rag.pipelines.pageindex import _bound_pageindex_provider, PAGEINDEX_OSS_PROVIDER
return sum(1 for n in dict.fromkeys(map(str, knowledge_bases)) if _bound_pageindex_provider(n) == PAGEINDEX_OSS_PROVIDER) Try / catch
try:
validate_pageindex_oss_selection(kbs)
except ValueError as e:
if "at most one PageIndex OSS" in str(e):
kbs = keep_single_oss_kb(kbs) # dedupe to first OSS entry
else:
raise Prevention
- Limit UI multi-select to one OSS KB.
- Call validate_pageindex_oss_selection at request assembly time.
- Merge OSS corpora into one KB instead of stacking them.
When it happens
Trigger: Calling PageIndex pipeline explore()/handle() with a knowledge_bases list containing two or more names that bind to the PageIndex OSS provider (deduplicated, non-empty).
Common situations: Users selecting multiple OSS KBs in the UI multi-select, or API clients concatenating KB lists from different sources; cloud PageIndex KBs coexist fine, so the error fires only on multiple OSS entries.
Related errors
- PageIndex API key is not configured. Add it under Knowledge
- PageIndex OSS preflight failed: {details}
- No embedding model is configured. Set up the embedding profi
- Knowledge base '{resolved_name}' is not in an error state. U
- Knowledge base not initialized ({self.rag_provider}): {kb_na
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/26c76ab9123e7842.
Report an issue: GitHub.