{"record":{"id":"25e4439679527502","repo":"HKUDS/DeepTutor","slug":"knowledge-base-kb-name-is-not-accessible-25e443","errorCode":null,"errorMessage":"Knowledge base '{kb_name}' is not accessible.","messagePattern":"Knowledge base '(.+?)' is not accessible\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deeptutor/tools/rag_tool.py","lineNumber":41,"sourceCode":"    \"\"\"Retrieve passages from ``kb_name`` and synthesise an answer.\n\n    ``kb_name`` must match a knowledge base the current user can access;\n    multi-user routing is delegated to :func:`resolve_for_rag` when no\n    explicit ``kb_base_dir`` is given.\n    \"\"\"\n    query = query.strip() if isinstance(query, str) else \"\"\n    kb_name = kb_name.strip() if isinstance(kb_name, str) else \"\"\n    if not query:\n        raise ValueError(\"RAG query must be a non-empty string.\")\n    if not kb_name:\n        raise ValueError(\"RAG requires an explicit kb_name.\")\n\n    if kb_base_dir is None:\n        from deeptutor.multi_user.knowledge_access import resolve_for_rag\n\n        resource = resolve_for_rag(kb_name)\n        if resource is None:\n            raise ValueError(f\"Knowledge base '{kb_name}' is not accessible.\")\n        kb_base_dir = str(resource.base_dir)\n        kb_name = resource.name\n\n    service = RAGService(kb_base_dir=kb_base_dir, provider=provider)\n    return await service.search(\n        query=query,\n        kb_name=kb_name,\n        event_sink=event_sink,\n        **kwargs,\n    )\n\n\nasync def initialize_rag(\n    kb_name: str,\n    documents: List[str],\n    provider: Optional[str] = None,\n    kb_base_dir: Optional[str] = None,\n    **kwargs,","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/tools/rag_tool.py#L23-L59","documentation":"Multi-user resolution failure in rag_search: resolve_for_rag could not map kb_name to any knowledge base the current user may read (not owned, not assigned, not admin). The sentinel wraps the access-denied/not-found outcome so callers get a single ValueError.","triggerScenarios":"Thrown at deeptutor/tools/rag_tool.py:41 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the KB name with `deeptutor kb list`","Ask an admin to assign the admin-curated KB to the user","Use a KB the current user owns or has been granted"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","contentChangedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}