reflex-dev/reflex · error · AttributeError
f"Passing multiple children to Icon component is not allowed
Error message
f"Passing multiple children to Icon component is not allowed: remove positional arguments {children[1:]} to fix" What it means
rx.icon() from reflex-components-lucide takes exactly one positional child — the icon name. Multiple positional arguments mean the developer likely passed children like a normal layout component, but Icon renders a single SVG by tag, so Reflex raises AttributeError listing the offending extra arguments.
Source
Thrown at packages/reflex-components-lucide/src/reflex_components_lucide/icon.py:59
**props: The keyword arguments
Returns:
The created component.
Raises:
AttributeError: The errors tied to bad usage of the Icon component.
TypeError: If the icon name is not a string.
"""
if children:
if len(children) == 1:
child = Var.create(children[0]).guess_type()
if not isinstance(child, StringVar):
msg = f"Icon name must be a string, got {children[0]._var_type if isinstance(children[0], Var) else children[0]}"
raise AttributeError(msg)
props["tag"] = children[0]
else:
msg = f"Passing multiple children to Icon component is not allowed: remove positional arguments {children[1:]} to fix"
raise AttributeError(msg)
if "tag" not in props:
msg = "Missing 'tag' keyword-argument for Icon"
raise AttributeError(msg)
tag_var: Var | LiteralVar = Var.create(props.pop("tag"))
if isinstance(tag_var, LiteralVar):
if isinstance(tag_var, LiteralStringVar):
tag = format.to_snake_case(tag_var._var_value.lower())
else:
msg = f"Icon name must be a string, got {type(tag_var)}"
raise TypeError(msg)
elif isinstance(tag_var, Var):
tag_stringified = tag_var.guess_type()
if not isinstance(tag_stringified, StringVar):
msg = f"Icon name must be a string, got {tag_var._var_type}"
raise TypeError(msg)
return DynamicIcon.create(name=tag_stringified.replace("_", "-"), **props)
View on GitHub (pinned to 45b8ed5ab7)
Solutions
- Keep only one positional icon name: rx.icon('home')
- Render multiple icons as siblings: rx.hstack(rx.icon('home'), rx.icon('settings'))
Example fix
# before
rx.icon('home', 'settings')
# after
rx.hstack(rx.icon('home'), rx.icon('settings')) Defensive patterns
Strategy: validation
Validate before calling
assert len(icon_args) == 1, 'pass exactly one icon name'
Prevention
- Never unpack lists into rx.icon; map over them instead
When it happens
Trigger: rx.icon('home', 'settings'), rx.icon(*['home','x']), or passing an icon name plus additional elements.
Common situations: Copy-pasting from rx.box(...)-style code, or unpacking a list of icon names into rx.icon().
Related errors
- f"Icon name must be a string, got {children[0]._var_type if
- Missing 'tag' keyword-argument for Icon
- f"Icon name must be a string, got {type(tag_var)}"
- f"Icon name must be a string, got {tag_var._var_type}"
- ChildrenTypeError(component=cls.__name__, child=child)
AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28).
Data as JSON: /api/errors/413f17b1bc6da29a.
Report an issue: GitHub.