{"record":{"id":"ef8fa8dbd00e8394","repo":"zylon-ai/private-gpt","slug":"artifact-artifact-exceeds-the-self-max-content","errorCode":null,"errorMessage":"Artifact {artifact} exceeds the {self.max_content_nodes} node limit","messagePattern":"Artifact (.+?) exceeds the (.+?) node limit","errorType":"error_code","errorClass":"ContentRequestLimitError","httpStatus":413,"severity":"error","filePath":"private_gpt/server/content/content_service.py","lineNumber":329,"sourceCode":"                    parse_component=self.parse_component,\n                )\n                vector_artifact_index.populated_or_error()\n\n        # Get all nodes for each artifact\n        for artifact in artifacts:\n            nodes = self._get_nodes_for_artifact(\n                context_filter=context_filter,\n                artifact=artifact,\n                include=include if include else None,\n                exclude=exclude if exclude else None,\n                node_ids=node_ids,\n                include_children=include_children if node_ids else False,\n                include_ancestors=include_ancestors if node_ids else False,\n            )\n            if not nodes:\n                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                )","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/server/content/content_service.py#L311-L347","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Narrow the request: target deeper node_ids, set include_children=False, or use include/exclude type filters.","Raise max_content_nodes if full-artifact access is required.","Re-ingest with coarser chunking to reduce the node count per artifact."],"exampleFix":"# before\nnodes = service._get_nodes_for_artifact(context_filter, artifact='doc-42', include_children=True)  # whole tree\n\n# after\nnodes = service._get_nodes_for_artifact(context_filter, artifact='doc-42', node_ids=['node-9001'], include_children=True)  # scoped subtree","handlingStrategy":"validation","validationCode":"node_count = count_retrieved_nodes(artifact, context_filter)\nif node_count > service.max_content_nodes:\n    context_filter.node_ids = deeper_ids(context_filter.node_ids)  # narrow","typeGuard":null,"tryCatchPattern":"try:\n    for a, root in service.stream_content(context_filter):\n        process(a, root)\nexcept ContentRequestLimitError:\n    process_artifact_in_batches(artifact, node_id_batches)","preventionTips":["Prefer targeted node_ids over root expansions","Set include_children=False when counts are near the cap","Know each artifact's node count after ingestion"],"tags":["content","limits","artifacts","tree"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}