{"record":{"id":"ee58feffcfc8dca6","repo":"zylon-ai/private-gpt","slug":"content-request-exceeds-the-self-max-content-arti","errorCode":null,"errorMessage":"Content request exceeds the {self.max_content_artifacts} artifact limit","messagePattern":"Content request exceeds the (.+?) artifact limit","errorType":"error_code","errorClass":"ContentRequestLimitError","httpStatus":413,"severity":"error","filePath":"private_gpt/server/content/content_service.py","lineNumber":296,"sourceCode":"\n    def _retrieve_document_node(\n        self,\n        context_filter: ContextFilter,\n        include: list[type[NodeType]] | None = None,\n        exclude: list[type[NodeType]] | None = None,\n        node_ids: list[str] | None = None,\n        include_children: bool = True,\n        include_ancestors: bool = False,\n    ) -> Generator[tuple[str, TreeNode], None, None]:\n        collection = context_filter.collection\n\n        # List unique root nodes\n        artifacts: list[str] = context_filter.artifacts or []\n        if not artifacts:\n            artifacts = self.node_store_component.get_list_of_artifact_ids(collection)\n        artifacts = list(set(artifacts))\n        if len(artifacts) > self.max_content_artifacts:\n            raise ContentRequestLimitError(\n                f\"Content request exceeds the {self.max_content_artifacts} artifact limit\"\n            )\n\n        # If artifacts are provided, verify the related required indexes are ready\n        # or throw an error\n        if artifacts:\n            for artifact in artifacts:\n                vector_artifact_index = VectorArtifactIndex(\n                    collection=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,\n                    ingest_component=self.ingest_component,\n                    parse_component=self.parse_component,\n                )\n                vector_artifact_index.populated_or_error()\n","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/server/content/content_service.py#L278-L314","documentation":"ContentRequestLimitError raised when the number of unique artifacts to process exceeds self.max_content_artifacts. The artifact list comes from context_filter.artifacts or, when unset, from listing all artifact ids in the collection — so an unfiltered request against a large collection trips the cap.","triggerScenarios":"Content/retrieval request with context_filter.artifacts omitted on a collection containing more artifacts than max_content_artifacts, or explicitly listing too many artifacts.","commonSituations":"Forgetting to scope context_filter after ingesting many documents; collections growing over time until unfiltered requests suddenly fail; bulk-export scripts iterating all artifacts in one call.","solutions":["Set context_filter.artifacts to the specific ids you need (within the cap).","Batch requests so each stays under max_content_artifacts.","Raise the max_content_artifacts setting for workloads that legitimately span many artifacts."],"exampleFix":"# before\ncontext_filter = ContextFilter(collection='default')  # processes every artifact\n\n# after\ncontext_filter = ContextFilter(collection='default', artifacts=['doc-42', 'doc-43'])","handlingStrategy":"validation","validationCode":"artifacts = context_filter.artifacts or node_store_component.get_list_of_artifact_ids(collection)\nassert len(set(artifacts)) <= service.max_content_artifacts, 'too many artifacts — batch or filter'","typeGuard":null,"tryCatchPattern":"try:\n    results = list(service.stream_content(context_filter))\nexcept ContentRequestLimitError:\n    for batch in chunkify(all_artifact_ids, service.max_content_artifacts):\n        results += list(service.stream_content(replace(context_filter, artifacts=batch)))","preventionTips":["Always set context_filter.artifacts on large collections","Batch bulk operations under the cap","Monitor collection growth against the configured limit"],"tags":["content","limits","artifacts","retrieval"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}