reflex-dev/reflex · error · ValueError
f"No markdown component found for tag: {tag}."
Error message
f"No markdown component found for tag: {tag}." What it means
When customizing rx.markdown(component_map={...}), the component_map must contain an entry for every markdown tag Reflex renders (h1, p, code, etc.). get_component looks up the component factory by tag and raises ValueError for unknown tags — including tags introduced in a base map you overrode or removed.
Source
Thrown at packages/reflex-components-markdown/src/reflex_components_markdown/markdown.py:362
)
def get_component(self, tag: str, **props) -> Component:
"""Get the component for a tag and props.
Args:
tag: The tag of the component.
**props: The props of the component.
Returns:
The component.
Raises:
ValueError: If the tag is invalid.
"""
# Check the tag is valid.
if tag not in self.component_map:
msg = f"No markdown component found for tag: {tag}."
raise ValueError(msg)
# If the children are set as a prop, don't pass them as children.
children = [_CHILDREN] if props.get("children") is None else []
# Get the component.
return self.component_map[tag](*children, **props).set(special_props=[_PROPS])
def format_component(self, tag: str, **props) -> str:
"""Format a component for rendering in the component map.
Args:
tag: The tag of the component.
**props: Extra props to pass to the component function.
Returns:
The formatted component.
"""
return str(self.get_component(tag, **props)).replace("\n", "")
View on GitHub (pinned to 45b8ed5ab7)
Solutions
- Merge your map over the base: component_map={**rx.markdown.default_component_map, 'h1': my_h1} (or extend the map returned by get_base_component_map rather than replacing it)
- Check the exact tag string casing in your component_map keys
- Upgrade reflex-components-markdown — new markdown tags in newer versions require an updated base map
Example fix
# before
rx.markdown(src, component_map={'h1': custom_h1})
# after
from reflex_components_markdown.markdown import get_base_component_map
rx.markdown(src, component_map={**get_base_component_map(), 'h1': custom_h1}) Defensive patterns
Strategy: validation
Validate before calling
from reflex_components_markdown.markdown import get_base_component_map
merged = {**get_base_component_map(), **custom}
for tag in required_tags:
assert tag in merged, f'missing tag {tag}' Prevention
- Always merge over the base component map, never replace it
- Test-render sample markdown after customizing component_map
When it happens
Trigger: Passing a component_map that replaces the base map without covering all standard tags, or referencing a tag string with different casing/typo in _get_tag_map customizations.
Common situations: Extending markdown styling by supplying only your custom tags instead of merging with the default map; overriding 'code' handling and breaking the lookup for nested tags like 'codeblock'.
Related errors
- Markdown component must have exactly one child containing th
- f"Expected EscapeSequence to have a single RawText child, go
- ChildrenTypeError(component=cls.__name__, child=child)
- Do not override _add_style directly. Use add_style instead.
- The component `{comp_name}` cannot have `{child_name}` as a
AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28).
Data as JSON: /api/errors/90efa32765ef7b82.
Report an issue: GitHub.