{"record":{"id":"d64096016877ff56","repo":"zylon-ai/private-gpt","slug":"only-one-ingested-context-is-supported","errorCode":null,"errorMessage":"Only one ingested context is supported.","messagePattern":"Only one ingested context is supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/tools/processors/semantic_search_processor.py","lineNumber":45,"sourceCode":"    async def intercept(self, request: ResolvedChatRequest) -> bool:\n        for tool in request.tool_config.tools:\n            if not _tool_matches(\n                tool, SEMANTIC_SEARCH_TOOL_NAME\n            ) or not _is_unresolved_tool(tool):\n                continue\n\n            tool_context = _get_tool_context(request, tool)\n            ingested_artifacts = (\n                [a for a in tool_context if isinstance(a, IngestedArtifact)]\n                if tool_context\n                else None\n            )\n            if not ingested_artifacts:\n                raise ValueError(\n                    \"Semantic search tool requires an ingested artifact context.\",\n                )\n            if len(ingested_artifacts) > 1:\n                raise ValueError(\"Only one ingested context is supported.\")\n\n            resolved = await self._builder.build_tool(\n                model_id=request.system.model,\n                name=tool.name or SEMANTIC_SEARCH_TOOL_NAME,\n                type=tool.type or SEMANTIC_SEARCH_TOOL_NAME + \"_v1\",\n                context_filter=ingested_artifacts[0].context_filter,\n                generate_citations=request.citation.enabled,\n                validate=request.tool_config.validation_mode,\n                token_limit=request.context.maximum_context_length,\n            )\n            return _replace_tool(request, tool, [resolved])\n        return False\n","sourceCodeStart":27,"sourceCodeEnd":58,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/tools/processors/semantic_search_processor.py#L27-L58","documentation":"Raised by the SemanticSearchProcessor when the semantic search tool's context contains more than one IngestedArtifact. The tool builder binds to exactly one context_filter, so multiple ingested contexts are ambiguous and rejected.","triggerScenarios":"Attaching two or more IngestedArtifact entries (e.g. two knowledge bases) to a single semantic search tool entry in one request.","commonSituations":"UI letting users multi-select documents/knowledge bases; merging contexts from several ingested collections into one tool call; retrying a request and accidentally appending a second artifact.","solutions":["Reduce the tool context to a single IngestedArtifact (pick the intended corpus)","If multiple corpora must be searched, issue one request per corpus/tool entry instead of one tool with many artifacts","Combine corpora at ingest time into one collection and use its single context_filter"],"exampleFix":"# before\ncontext=[IngestedArtifact(cf_kb1), IngestedArtifact(cf_kb2)]\n# after\ncontext=[IngestedArtifact(cf_kb1)]  # one tool per corpus, or merge at ingest time","handlingStrategy":"validation","validationCode":"ingested = [a for a in (tool_context or []) if isinstance(a, IngestedArtifact)]\nassert len(ingested) <= 1, \"semantic search supports exactly one IngestedArtifact\"","typeGuard":null,"tryCatchPattern":"try:\n    resp = await client.chat(request)\nexcept ValueError as e:\n    if \"Only one ingested context\" in str(e):\n        # split into one request per IngestedArtifact and resend\n        raise","preventionTips":["Enforce single-select for knowledge bases when composing semantic search requests","Dedupe artifact lists by context_filter identity before attaching","Fan out multi-corpus searches as parallel single-corpus requests"],"tags":["tools","validation","semantic-search","rag"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}