{"record":{"id":"fa71d9460e8a7aff","repo":"zylon-ai/private-gpt","slug":"artifact-artifact-exceeds-the-self-max-content-fa71d9","errorCode":null,"errorMessage":"Artifact {artifact} exceeds the {self.max_content_depth} depth limit","messagePattern":"Artifact (.+?) exceeds the (.+?) depth limit","errorType":"error_code","errorClass":"ContentRequestLimitError","httpStatus":413,"severity":"error","filePath":"private_gpt/server/content/content_service.py","lineNumber":345,"sourceCode":"                continue\n            if len(nodes) > self.max_content_nodes:\n                raise ContentRequestLimitError(\n                    f\"Artifact {artifact} exceeds the {self.max_content_nodes} node limit\"\n                )\n\n            # Sort nodes by their position in the tree\n            nodes = sorted(\n                nodes,\n                key=lambda n: n.abs_idx,\n            )\n\n            # Rebuilt the tree structure\n            root_nodes = TreeNode.rebuild_tree(nodes)\n            root_node = root_nodes[0] if root_nodes else None\n            if not root_node:\n                continue\n            if max((node.depth for node in nodes), default=0) > self.max_content_depth:\n                raise ContentRequestLimitError(\n                    f\"Artifact {artifact} exceeds the {self.max_content_depth} depth limit\"\n                )\n\n            yield artifact, root_node\n\n            # Cleanup\n            del root_node\n            del nodes\n\n    async def retrieve_document_nodes_async(\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    ) -> AsyncGenerator[tuple[str, TreeNode]]:","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/server/content/content_service.py#L327-L363","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Inspect the artifact's node depths (node.depth distribution) to confirm whether data is corrupt or legitimately deep.","Re-ingest the source document if depth metadata is corrupt.","Raise max_content_depth for legitimately deep artifacts.","Fix ingestion to cap nesting depth when building nodes."],"exampleFix":"# settings\n# before\nmax_content_depth: int = 20\n# after\nmax_content_depth: int = 64","handlingStrategy":"validation","validationCode":"depths = [n.depth for n in nodes]\nif max(depths, default=0) > service.max_content_depth:\n    flag_artifact_for_repair(artifact)  # corrupt or too deep","typeGuard":null,"tryCatchPattern":"try:\n    for a, root in service.stream_content(context_filter):\n        yield a, root\nexcept ContentRequestLimitError:\n    log.error('artifact %s exceeds depth cap — re-ingest source', a)","preventionTips":["Validate depth metadata at ingestion time","Cap nesting when building the tree from nested sources","Re-ingest sources whose trees exceed the cap instead of raising the limit blindly"],"tags":["content","limits","tree","depth","ingestion"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}