{"record":{"id":"ca64f69b0ac16c83","repo":"run-llama/llama_index","slug":"cannot-specify-both-node-parser-ids-and-chunk-size","errorCode":null,"errorMessage":"Cannot specify both node_parser_ids and chunk_sizes.","messagePattern":"Cannot specify both node_parser_ids and chunk_sizes\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/node_parser/relational/hierarchical.py","lineNumber":141,"sourceCode":"        callback_manager = callback_manager or CallbackManager([])\n\n        if node_parser_ids is None:\n            if chunk_sizes is None:\n                chunk_sizes = [2048, 512, 128]\n\n            node_parser_ids = [f\"chunk_size_{chunk_size}\" for chunk_size in chunk_sizes]\n            node_parser_map = {}\n            for chunk_size, node_parser_id in zip(chunk_sizes, node_parser_ids):\n                node_parser_map[node_parser_id] = SentenceSplitter(\n                    chunk_size=chunk_size,\n                    callback_manager=callback_manager,\n                    chunk_overlap=chunk_overlap,\n                    include_metadata=include_metadata,\n                    include_prev_next_rel=include_prev_next_rel,\n                )\n        else:\n            if chunk_sizes is not None:\n                raise ValueError(\"Cannot specify both node_parser_ids and chunk_sizes.\")\n            if node_parser_map is None:\n                raise ValueError(\n                    \"Must specify node_parser_map if using node_parser_ids.\"\n                )\n\n        return cls(\n            chunk_sizes=chunk_sizes,\n            node_parser_ids=node_parser_ids,\n            node_parser_map=node_parser_map,\n            include_metadata=include_metadata,\n            include_prev_next_rel=include_prev_next_rel,\n            callback_manager=callback_manager,\n        )\n\n    @classmethod\n    def class_name(cls) -> str:\n        return \"HierarchicalNodeParser\"\n","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/node_parser/relational/hierarchical.py#L123-L159","documentation":"Error \"Cannot specify both node_parser_ids and chunk_sizes.\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/node_parser/relational/hierarchical.py:141 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass either node_parser_ids or chunk_sizes, not both.","Remove one of the two arguments from HierarchicalNodeParser.from_defaults."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}