{"record":{"id":"9008c249ff4851df","repo":"run-llama/llama_index","slug":"texts-and-metadata-strs-must-have-the-same-length","errorCode":null,"errorMessage":"Texts and metadata_strs must have the same length","messagePattern":"Texts and metadata_strs must have the same length","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/node_parser/interface.py","lineNumber":263,"sourceCode":"\n        doc = getattr(user_init, \"__doc__\", None)\n        if not doc:\n            return\n\n        # Patch the generated __init__ that help() will show\n        try:\n            cls.__init__.__doc__ = doc\n        except (AttributeError, TypeError):\n            pass\n\n    @abstractmethod\n    def split_text_metadata_aware(self, text: str, metadata_str: str) -> List[str]: ...\n\n    def split_texts_metadata_aware(\n        self, texts: List[str], metadata_strs: List[str]\n    ) -> List[str]:\n        if len(texts) != len(metadata_strs):\n            raise ValueError(\"Texts and metadata_strs must have the same length\")\n        nested_texts = [\n            self.split_text_metadata_aware(text, metadata)\n            for text, metadata in zip(texts, metadata_strs)\n        ]\n        return [item for sublist in nested_texts for item in sublist]\n\n    def _get_metadata_str(self, node: BaseNode) -> str:\n        \"\"\"Helper function to get the proper metadata str for splitting.\"\"\"\n        embed_metadata_str = node.get_metadata_str(mode=MetadataMode.EMBED)\n        llm_metadata_str = node.get_metadata_str(mode=MetadataMode.LLM)\n\n        # use the longest metadata str for splitting\n        if len(embed_metadata_str) > len(llm_metadata_str):\n            metadata_str = embed_metadata_str\n        else:\n            metadata_str = llm_metadata_str\n\n        return metadata_str","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/node_parser/interface.py#L245-L281","documentation":"Error \"Texts and metadata_strs must have the same length\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/node_parser/interface.py:263 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass texts and metadata_strs lists of equal length.","Pad or trim the metadata_strs list so it matches the number of texts."],"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-15T22:17:37.221Z"}