zylon-ai/private-gpt · error · ContentRequestLimitError

Artifact exceeds the depth limit

Error message

Artifact {artifact} exceeds the {self.max_content_depth} depth limit

What it means

ContentRequestLimitError raised after tree rebuild when max(node.depth) over the artifact's nodes exceeds self.max_content_depth. It guards against pathological nesting (cycles, corrupt parent links, or genuinely deep documents) before yielding the artifact root.

Solutions

  1. Inspect the artifact's node depths (node.depth distribution) to confirm whether data is corrupt or legitimately deep.
  2. Re-ingest the source document if depth metadata is corrupt.
  3. Raise max_content_depth for legitimately deep artifacts.
  4. Fix ingestion to cap nesting depth when building nodes.

Example fix

# settings
# before
max_content_depth: int = 20
# after
max_content_depth: int = 64
Defensive patterns

Strategy: validation

Validate before calling

depths = [n.depth for n in nodes]
if max(depths, default=0) > service.max_content_depth:
    flag_artifact_for_repair(artifact)  # corrupt or too deep

Try / catch

try:
    for a, root in service.stream_content(context_filter):
        yield a, root
except ContentRequestLimitError:
    log.error('artifact %s exceeds depth cap — re-ingest source', a)

Prevention

When it happens

Trigger: An artifact whose rebuilt tree contains a node deeper than max_content_depth; commonly caused by corrupt abs_idx/parent metadata producing degenerate chains, or deeply nested source structures (nested lists, XML).

Common situations: Ingestion bugs writing wrong depth/parent fields; documents with pathological nesting; max_content_depth default too low for legitimate deep trees; TreeNode.rebuild_tree chaining nodes linearly due to missing parents.

Related errors


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

Appendix: source

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

                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"
                )

            yield artifact, root_node

            # Cleanup
            del root_node
            del nodes

    async def retrieve_document_nodes_async(
        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,
    ) -> AsyncGenerator[tuple[str, TreeNode]]:

View on GitHub (pinned to 4a030776a3)