{"record":{"id":"747166ab5197cb5b","repo":"run-llama/llama_index","slug":"unsupported-content-block-type-bank-block-type","errorCode":null,"errorMessage":"Unsupported content block type: {bank_block.type}","messagePattern":"Unsupported content block type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/prompts/rich.py","lineNumber":119,"sourceCode":"                    ChatMessage(role=bank_message.role, content=bank_message.content)\n                )\n            elif isinstance(bank_message.content, list):\n                llama_blocks: list[ContentBlock] = []\n                for bank_block in bank_message.content:\n                    if bank_block.type == BanksContentBlockType.text:\n                        llama_blocks.append(TextBlock(text=bank_block.text))\n                    elif bank_block.type == BanksContentBlockType.image_url:\n                        llama_blocks.append(ImageBlock(url=bank_block.image_url.url))\n                    elif bank_block.type == BanksContentBlockType.audio:\n                        llama_blocks.append(AudioBlock(url=bank_block.input_audio.data))\n                    elif bank_block.type == BanksContentBlockType.video:\n                        llama_blocks.append(VideoBlock(url=bank_block.input_video.data))\n                    elif bank_block.type == BanksContentBlockType.document:\n                        llama_blocks.append(\n                            DocumentBlock(url=bank_block.input_document.data)\n                        )\n                    else:\n                        raise ValueError(\n                            f\"Unsupported content block type: {bank_block.type}\"\n                        )\n\n                llama_messages.append(\n                    ChatMessage(role=bank_message.role, content=llama_blocks)\n                )\n            else:\n                raise ValueError(\n                    f\"Unsupported message content type: {type(bank_message.content)}\"\n                )\n\n        if self.output_parser is not None:\n            llama_messages = self.output_parser.format_messages(llama_messages)\n\n        return llama_messages\n\n    def get_template(self, llm: Optional[BaseLLM] = None) -> str:\n        return self.template_str","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/prompts/rich.py#L101-L137","documentation":"In prompts/rich.py, when a RichContext converts message-bank messages to llama-index ChatMessages, each content block is mapped by its BanksContentBlockType. Only text, image_url, audio, video, and document are handled; any other enum value falls through to ValueError(f\"Unsupported content block type: {bank_block.type}\"). This is a coverage gap between the banks SDK's content-block enum and llama-index's converter, not a user-format error per se.","triggerScenarios":"Using a Rich prompt template whose messages include a content-block type the installed llama-index-core version does not map — e.g. a newer banks SDK adds a block type (file, tool_call, thinking, etc.) and you feed it through rich_utils / RichPromptTemplate.format(); the else-branch raises during conversion.","commonSituations":"Version skew: the `banks` (message-bank) package upgraded ahead of llama-index-core, or running a llama-index fork/nightly where the mapping lags. Also triggered by manually constructing bank messages with exotic block types and passing them to a RichContext.","solutions":["Pin compatible versions: upgrade llama-index-core to a release whose rich.py maps the block type you use, or downgrade the banks package to one whose enum only contains mapped types.","Restrict your Rich template messages to supported blocks (text, image_url, audio, video, document).","If you control the message list, strip/convert unsupported blocks to text before formatting.","Longer term: subclass/extend the converter (or patch the mapping) to handle the extra block type, and upstream the change to llama-index."],"exampleFix":"# before\nmsg = bank_message(\n    role=\"user\",\n    content=[TextBlock(...), SomeNewBlockType(...)],  # not in rich.py mapping\n)\nllama_messages = rich_context.format_messages([msg])  # -> ValueError\n\n# after\nmsg = bank_message(\n    role=\"user\",\n    content=[TextBlock(...)],  # stick to mapped types (text/image/audio/video/doc)\n)\nllama_messages = rich_context.format_messages([msg])","handlingStrategy":"type-guard","validationCode":"SUPPORTED_BLOCK_TYPES = {\"text\", \"image_url\", \"audio\", \"video\", \"document\"}\n\ndef assert_bank_blocks_supported(messages) -> None:\n    for m in messages:\n        if isinstance(m.content, list):\n            for b in m.content:\n                if getattr(b, \"type\", None) not in SUPPORTED_BLOCK_TYPES:\n                    raise TypeError(\n                        f\"block type {getattr(b, 'type', None)!r} not mapped by rich.py; \"\n                        \"upgrade llama-index-core or drop the block.\"\n                    )","typeGuard":"def is_supported_bank_block(block) -> bool:\n    t = getattr(block, \"type\", None)\n    return isinstance(t, str) and t in {\"text\", \"image_url\", \"audio\", \"video\", \"document\"}","tryCatchPattern":null,"preventionTips":["Pin llama-index-core and the banks/message SDK to versions released together; check release notes for new block types.","Constrain rich-template messages to text/image/audio/video/document blocks.","Wrap format_messages() in a component that filters unsupported blocks before conversion."],"tags":["llama-index","rich","content-blocks","version-skew","multimodal"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}