zylon-ai/private-gpt · error · ValueError

context_filter is required

Error message

context_filter is required

What it means

ValueError from TabularDataToolBuilder._validate_context: the tabular data analysis tool operates on ingested tabular data located via a context_filter, and None was passed. Validation is the first async step before artifact index checks.

Source

Thrown at private_gpt/components/tools/builders/tabular_data_builder.py:125

        embedding_component: EmbeddingComponent,
        ingest_component: IngestComponent,
        parse_component: ParseComponent,
        sandbox_component: SandboxComponent,
    ) -> None:
        self.settings = settings
        self.llm_component = llm_component
        self.vector_store_component = vector_store_component
        self.node_store_component = node_store_component
        self.embedding_component = embedding_component
        self.ingest_component = ingest_component
        self.parse_component = parse_component
        self.sandbox_component = sandbox_component

    async def _validate_context(
        self, context_filter: ContextFilter | None
    ) -> ContextFilter:
        if not context_filter:
            raise ValueError("context_filter is required")

        if not context_filter.collection:
            raise ValueError("collection is required in context")

        # If artifacts are provided, verify the related required indexes are ready
        # or throw an error
        artifacts = (
            list(set(context_filter.artifacts)) if context_filter.artifacts else None
        )
        if artifacts:
            tasks: list[Coroutine[Any, Any, None]] = []
            for artifact in artifacts:
                vector_artifact_index = VectorArtifactIndex(
                    collection=context_filter.collection,
                    artifact=artifact,
                    vector_store_component=self.vector_store_component,
                    node_store_component=self.node_store_component,
                    embedding_component=self.embedding_component,

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Pass a ContextFilter with a non-empty collection (and typically artifacts pointing at the tabular files) when calling the tool.
  2. Mark context_filter as required in the tool schema so the model/agent always supplies it.
Defensive patterns

Strategy: validation

Validate before calling

if context_filter is None:
    raise ValueError("tabular analysis requires context_filter")
result = await tabular_tool(prompt=p, context_filter=context_filter)

Type guard

def is_valid_tabular_context(cf) -> bool:
    return cf is not None and bool(cf.collection)

Prevention

When it happens

Trigger: Invoking the tabular data tool with context_filter=None or omitting the argument.

Common situations: Agent tool schema does not force the context argument; integration builds the call payload manually and drops the field; workflow forwards an unset variable.

Related errors


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