{"record":{"id":"a08bff810feb7534","repo":"run-llama/llama_index","slug":"metadata-length-metadata-len-is-longer-than-ch","errorCode":null,"errorMessage":"Metadata length ({metadata_len}) is longer than chunk size ({self.chunk_size}). Consider increasing the chunk size or decreasing the size of your metadata to avoid this.","messagePattern":"Metadata length \\((.+?)\\) is longer than chunk size \\((.+?)\\)\\. Consider increasing the chunk size or decreasing the size of your metadata to avoid this\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/node_parser/text/sentence.py","lineNumber":160,"sourceCode":"            chunk_overlap=chunk_overlap,\n            tokenizer=tokenizer,\n            paragraph_separator=paragraph_separator,\n            chunking_tokenizer_fn=chunking_tokenizer_fn,\n            secondary_chunking_regex=secondary_chunking_regex,\n            callback_manager=callback_manager,\n            include_metadata=include_metadata,\n            include_prev_next_rel=include_prev_next_rel,\n        )\n\n    @classmethod\n    def class_name(cls) -> str:\n        return \"SentenceSplitter\"\n\n    def split_text_metadata_aware(self, text: str, metadata_str: str) -> List[str]:\n        metadata_len = len(self._tokenizer(metadata_str))\n        effective_chunk_size = self.chunk_size - metadata_len\n        if effective_chunk_size <= 0:\n            raise ValueError(\n                f\"Metadata length ({metadata_len}) is longer than chunk size \"\n                f\"({self.chunk_size}). Consider increasing the chunk size or \"\n                \"decreasing the size of your metadata to avoid this.\"\n            )\n        elif effective_chunk_size < 50:\n            print(\n                f\"Metadata length ({metadata_len}) is close to chunk size \"\n                f\"({self.chunk_size}). Resulting chunks are less than 50 tokens. \"\n                \"Consider increasing the chunk size or decreasing the size of \"\n                \"your metadata to avoid this.\",\n                flush=True,\n            )\n\n        return self._split_text(text, chunk_size=effective_chunk_size)\n\n    def split_text(self, text: str) -> List[str]:\n        return self._split_text(text, chunk_size=self.chunk_size)\n","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/node_parser/text/sentence.py#L142-L178","documentation":"Error \"Metadata length ({metadata_len}) is longer than chunk size ({self.chunk_size}). Consider increasing the chunk size or decreasing the size of your metadata to avoid this.\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/node_parser/text/sentence.py:160 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Increase chunk_size so metadata plus content fits.","Reduce metadata size or set metadata to be excluded from the chunk length calculation."],"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"}