{"record":{"id":"6ab2b199b73072b4","repo":"zylon-ai/private-gpt","slug":"collection-is-required-in-context-6ab2b1","errorCode":null,"errorMessage":"collection is required in context","messagePattern":"collection is required in context","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/tools/builders/summary_builder.py","lineNumber":82,"sourceCode":"        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,\n                    vector_store_component=self.vector_store_component,\n                    node_store_component=self.node_store_component,\n                    embedding_component=self.embedding_component,","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/tools/builders/summary_builder.py#L64-L100","documentation":"ValueError from SummaryToolBuilder._validate_context: a context_filter was provided but collection is empty. The collection selects the vector store / node store indexes used to build the retriever for summarization; without it the retriever cannot be constructed.","triggerScenarios":"Calling the summary tool with context_filter whose collection is None/empty; the check runs before the component asserts and artifact index verification.","commonSituations":"Default-constructed ContextFilter (collection defaults to empty) passed through; copy-paste from a filter schema that uses a different field name (e.g. index_name) for the collection.","solutions":["Set context_filter.collection to the collection holding the documents to summarize.","Verify the collection was populated during ingestion; an empty-but-valid collection will summarize nothing."],"exampleFix":"# before\ncontext_filter = ContextFilter()\n\n# after\ncontext_filter = ContextFilter(collection=\"default\")","handlingStrategy":"validation","validationCode":"assert context_filter is not None and context_filter.collection, \"collection required\"\nworkflow = builder.build(context_filter=context_filter)","typeGuard":"def is_summarizable_context(cf) -> bool:\n    return cf is not None and bool(getattr(cf, \"collection\", None))","tryCatchPattern":null,"preventionTips":["Populate collection on every ContextFilter used for summarization.","Verify the collection contains documents (ingest completed) before summarizing."],"tags":["validation","summary","collection"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}