{"record":{"id":"cb982d94d799926c","repo":"zylon-ai/private-gpt","slug":"context-filter-is-required-cb982d","errorCode":null,"errorMessage":"context_filter is required","messagePattern":"context_filter is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/tools/builders/tabular_data_builder.py","lineNumber":125,"sourceCode":"        embedding_component: EmbeddingComponent,\n        ingest_component: IngestComponent,\n        parse_component: ParseComponent,\n        sandbox_component: SandboxComponent,\n    ) -> None:\n        self.settings = settings\n        self.llm_component = llm_component\n        self.vector_store_component = vector_store_component\n        self.node_store_component = node_store_component\n        self.embedding_component = embedding_component\n        self.ingest_component = ingest_component\n        self.parse_component = parse_component\n        self.sandbox_component = sandbox_component\n\n    async def _validate_context(\n        self, context_filter: ContextFilter | None\n    ) -> ContextFilter:\n        if not context_filter:\n            raise ValueError(\"context_filter is required\")\n\n        if not context_filter.collection:\n            raise ValueError(\"collection is required in context\")\n\n        # If artifacts are provided, verify the related required indexes are ready\n        # or throw an error\n        artifacts = (\n            list(set(context_filter.artifacts)) if context_filter.artifacts else None\n        )\n        if artifacts:\n            tasks: list[Coroutine[Any, Any, None]] = []\n            for artifact in artifacts:\n                vector_artifact_index = VectorArtifactIndex(\n                    collection=context_filter.collection,\n                    artifact=artifact,\n                    vector_store_component=self.vector_store_component,\n                    node_store_component=self.node_store_component,\n                    embedding_component=self.embedding_component,","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/tools/builders/tabular_data_builder.py#L107-L143","documentation":"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.","triggerScenarios":"Invoking the tabular data tool with context_filter=None or omitting the argument.","commonSituations":"Agent tool schema does not force the context argument; integration builds the call payload manually and drops the field; workflow forwards an unset variable.","solutions":["Pass a ContextFilter with a non-empty collection (and typically artifacts pointing at the tabular files) when calling the tool.","Mark context_filter as required in the tool schema so the model/agent always supplies it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if context_filter is None:\n    raise ValueError(\"tabular analysis requires context_filter\")\nresult = await tabular_tool(prompt=p, context_filter=context_filter)","typeGuard":"def is_valid_tabular_context(cf) -> bool:\n    return cf is not None and bool(cf.collection)","tryCatchPattern":null,"preventionTips":["Require context_filter in the tool schema sent to the model.","Populate it from the chat context (collection + artifacts) in the tool-builder layer."],"tags":["validation","tabular","tool-input"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}