{"record":{"id":"809c1ba8c76c3ba4","repo":"zylon-ai/private-gpt","slug":"context-filter-is-required-809c1b","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/summary_builder.py","lineNumber":79,"sourceCode":"        content_service: ContentService | None = None,\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.content_service = content_service\n        self.prompt_builder_service = prompt_builder_service\n\n    def _create_text_retriever(self, texts: list[str]) -> InMemoryRetriever:\n        \"\"\"Create an in-memory retriever for text summarization.\"\"\"\n        return InMemoryRetriever.from_texts(texts=texts)\n\n    def _validate_context(self, context_filter: ContextFilter | None) -> 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        assert self.vector_store_component, \"Vector store component is required\"\n        assert self.node_store_component, \"Node store component is required\"\n        assert self.embedding_component, \"Embedding component is required\"\n        assert self.ingest_component, \"Ingest component is required\"\n        assert self.parse_component, \"Parse component is required\"\n        assert self.content_service, \"Content service is required\"\n\n        # If artifacts are provided, verify the related required indexes are ready\n        # or throw an error\n        if context_filter.artifacts:\n            for artifact in context_filter.artifacts:\n                vector_artifact_index = VectorArtifactIndex(\n                    collection=context_filter.collection,\n                    artifact=artifact,","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/tools/builders/summary_builder.py#L61-L97","documentation":"ValueError from SummaryToolBuilder._validate_context: the summarize workflow's context retrieval path requires a context_filter and it was None. This mirrors the semantic search builder's validation; the summary tool falls back to it when summarizing ingested documents rather than inline texts.","triggerScenarios":"Building/running the summarize workflow with context_filter=None while expecting document-based summarization; _validate_context is called from _create_context_retriever setup.","commonSituations":"Calling the summary tool with only texts is fine — this error only fires when the code path that needs context retrieval gets None; typically an integration passes context_filter conditionally and it ends up None.","solutions":["Pass a ContextFilter with a non-empty collection when you want document/collection summarization.","If summarizing raw strings only, pass texts and skip the context path entirely (see also error 269 which guards the both-empty case).","Make the caller's payload builder always populate one of texts or context_filter."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if context_filter is None:\n    if not texts:\n        raise ValueError(\"provide texts or a context_filter for summarization\")\n    workflow = builder.build(texts=texts)\nelse:\n    workflow = builder.build(context_filter=context_filter)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide upfront whether summarizing inline texts or a collection; never pass neither.","Wrap summarize-tool invocation in a payload validator that requires texts or context_filter."],"tags":["validation","summary","tool-input"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}