zylon-ai/private-gpt · error · ContentRequestLimitError

Content request exceeds the {self.max_content_artifacts} art

Error message

Content request exceeds the {self.max_content_artifacts} artifact limit

What it means

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.

Source

Thrown at private_gpt/server/content/content_service.py:296

    def _retrieve_document_node(
        self,
        context_filter: ContextFilter,
        include: list[type[NodeType]] | None = None,
        exclude: list[type[NodeType]] | None = None,
        node_ids: list[str] | None = None,
        include_children: bool = True,
        include_ancestors: bool = False,
    ) -> Generator[tuple[str, TreeNode], None, None]:
        collection = context_filter.collection

        # List unique root nodes
        artifacts: list[str] = context_filter.artifacts or []
        if not artifacts:
            artifacts = self.node_store_component.get_list_of_artifact_ids(collection)
        artifacts = list(set(artifacts))
        if len(artifacts) > self.max_content_artifacts:
            raise ContentRequestLimitError(
                f"Content request exceeds the {self.max_content_artifacts} artifact limit"
            )

        # If artifacts are provided, verify the related required indexes are ready
        # or throw an error
        if artifacts:
            for artifact in artifacts:
                vector_artifact_index = VectorArtifactIndex(
                    collection=collection,
                    artifact=artifact,
                    vector_store_component=self.vector_store_component,
                    node_store_component=self.node_store_component,
                    embedding_component=self.embedding_component,
                    ingest_component=self.ingest_component,
                    parse_component=self.parse_component,
                )
                vector_artifact_index.populated_or_error()

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Set context_filter.artifacts to the specific ids you need (within the cap).
  2. Batch requests so each stays under max_content_artifacts.
  3. Raise the max_content_artifacts setting for workloads that legitimately span many artifacts.

Example fix

# before
context_filter = ContextFilter(collection='default')  # processes every artifact

# after
context_filter = ContextFilter(collection='default', artifacts=['doc-42', 'doc-43'])
Defensive patterns

Strategy: validation

Validate before calling

artifacts = context_filter.artifacts or node_store_component.get_list_of_artifact_ids(collection)
assert len(set(artifacts)) <= service.max_content_artifacts, 'too many artifacts — batch or filter'

Try / catch

try:
    results = list(service.stream_content(context_filter))
except ContentRequestLimitError:
    for batch in chunkify(all_artifact_ids, service.max_content_artifacts):
        results += list(service.stream_content(replace(context_filter, artifacts=batch)))

Prevention

When it happens

Trigger: Content/retrieval request with context_filter.artifacts omitted on a collection containing more artifacts than max_content_artifacts, or explicitly listing too many artifacts.

Common situations: 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.

Related errors


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