zylon-ai/private-gpt · error · ContentRequestLimitError

Artifact {artifact} exceeds the {self.max_content_nodes} nod

Error message

Artifact {artifact} exceeds the {self.max_content_nodes} node limit

What it means

ContentRequestLimitError raised per-artifact when _get_nodes_for_artifact returns more nodes than self.max_content_nodes (after filters). Unlike the flatten-time cap (error 373), this fires during retrieval of nodes for a specific artifact before tree rebuild.

Source

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

                    parse_component=self.parse_component,
                )
                vector_artifact_index.populated_or_error()

        # Get all nodes for each artifact
        for artifact in artifacts:
            nodes = self._get_nodes_for_artifact(
                context_filter=context_filter,
                artifact=artifact,
                include=include if include else None,
                exclude=exclude if exclude else None,
                node_ids=node_ids,
                include_children=include_children if node_ids else False,
                include_ancestors=include_ancestors if node_ids else False,
            )
            if not nodes:
                continue
            if len(nodes) > self.max_content_nodes:
                raise ContentRequestLimitError(
                    f"Artifact {artifact} exceeds the {self.max_content_nodes} node limit"
                )

            # Sort nodes by their position in the tree
            nodes = sorted(
                nodes,
                key=lambda n: n.abs_idx,
            )

            # Rebuilt the tree structure
            root_nodes = TreeNode.rebuild_tree(nodes)
            root_node = root_nodes[0] if root_nodes else None
            if not root_node:
                continue
            if max((node.depth for node in nodes), default=0) > self.max_content_depth:
                raise ContentRequestLimitError(
                    f"Artifact {artifact} exceeds the {self.max_content_depth} depth limit"
                )

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Narrow the request: target deeper node_ids, set include_children=False, or use include/exclude type filters.
  2. Raise max_content_nodes if full-artifact access is required.
  3. Re-ingest with coarser chunking to reduce the node count per artifact.

Example fix

# before
nodes = service._get_nodes_for_artifact(context_filter, artifact='doc-42', include_children=True)  # whole tree

# after
nodes = service._get_nodes_for_artifact(context_filter, artifact='doc-42', node_ids=['node-9001'], include_children=True)  # scoped subtree
Defensive patterns

Strategy: validation

Validate before calling

node_count = count_retrieved_nodes(artifact, context_filter)
if node_count > service.max_content_nodes:
    context_filter.node_ids = deeper_ids(context_filter.node_ids)  # narrow

Try / catch

try:
    for a, root in service.stream_content(context_filter):
        process(a, root)
except ContentRequestLimitError:
    process_artifact_in_batches(artifact, node_id_batches)

Prevention

When it happens

Trigger: Requesting an artifact (optionally with node_ids/include_children) whose retrieved node set exceeds max_content_nodes; e.g. include_children=True on a root node of a huge artifact.

Common situations: Expanding a root/branch with children included; per-artifact limits lower than the artifact's actual node count after ingestion; filters not narrowing as expected.

Related errors


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