zylon-ai/private-gpt · error · ValueError

Only one ingested context is supported.

Error message

Only one ingested context is supported.

What it means

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.

Source

Thrown at private_gpt/components/tools/processors/semantic_search_processor.py:45

    async def intercept(self, request: ResolvedChatRequest) -> bool:
        for tool in request.tool_config.tools:
            if not _tool_matches(
                tool, SEMANTIC_SEARCH_TOOL_NAME
            ) or not _is_unresolved_tool(tool):
                continue

            tool_context = _get_tool_context(request, tool)
            ingested_artifacts = (
                [a for a in tool_context if isinstance(a, IngestedArtifact)]
                if tool_context
                else None
            )
            if not ingested_artifacts:
                raise ValueError(
                    "Semantic search tool requires an ingested artifact context.",
                )
            if len(ingested_artifacts) > 1:
                raise ValueError("Only one ingested context is supported.")

            resolved = await self._builder.build_tool(
                model_id=request.system.model,
                name=tool.name or SEMANTIC_SEARCH_TOOL_NAME,
                type=tool.type or SEMANTIC_SEARCH_TOOL_NAME + "_v1",
                context_filter=ingested_artifacts[0].context_filter,
                generate_citations=request.citation.enabled,
                validate=request.tool_config.validation_mode,
                token_limit=request.context.maximum_context_length,
            )
            return _replace_tool(request, tool, [resolved])
        return False

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Reduce the tool context to a single IngestedArtifact (pick the intended corpus)
  2. If multiple corpora must be searched, issue one request per corpus/tool entry instead of one tool with many artifacts
  3. Combine corpora at ingest time into one collection and use its single context_filter

Example fix

# before
context=[IngestedArtifact(cf_kb1), IngestedArtifact(cf_kb2)]
# after
context=[IngestedArtifact(cf_kb1)]  # one tool per corpus, or merge at ingest time
Defensive patterns

Strategy: validation

Validate before calling

ingested = [a for a in (tool_context or []) if isinstance(a, IngestedArtifact)]
assert len(ingested) <= 1, "semantic search supports exactly one IngestedArtifact"

Try / catch

try:
    resp = await client.chat(request)
except ValueError as e:
    if "Only one ingested context" in str(e):
        # split into one request per IngestedArtifact and resend
        raise

Prevention

When it happens

Trigger: Attaching two or more IngestedArtifact entries (e.g. two knowledge bases) to a single semantic search tool entry in one request.

Common situations: 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.

Related errors


AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15). Data as JSON: /api/errors/d64096016877ff56. Report an issue: GitHub.