{"record":{"id":"d77fc24bcef794cb","repo":"reflex-dev/reflex","slug":"missing-tag-keyword-argument-for-icon","errorCode":null,"errorMessage":"Missing 'tag' keyword-argument for Icon","messagePattern":"Missing 'tag' keyword-argument for Icon","errorType":"validation","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"packages/reflex-components-lucide/src/reflex_components_lucide/icon.py","lineNumber":62,"sourceCode":"            The created component.\n\n        Raises:\n            AttributeError: The errors tied to bad usage of the Icon component.\n            TypeError: If the icon name is not a string.\n        \"\"\"\n        if children:\n            if len(children) == 1:\n                child = Var.create(children[0]).guess_type()\n                if not isinstance(child, StringVar):\n                    msg = f\"Icon name must be a string, got {children[0]._var_type if isinstance(children[0], Var) else children[0]}\"\n                    raise AttributeError(msg)\n                props[\"tag\"] = children[0]\n            else:\n                msg = f\"Passing multiple children to Icon component is not allowed: remove positional arguments {children[1:]} to fix\"\n                raise AttributeError(msg)\n        if \"tag\" not in props:\n            msg = \"Missing 'tag' keyword-argument for Icon\"\n            raise AttributeError(msg)\n\n        tag_var: Var | LiteralVar = Var.create(props.pop(\"tag\"))\n        if isinstance(tag_var, LiteralVar):\n            if isinstance(tag_var, LiteralStringVar):\n                tag = format.to_snake_case(tag_var._var_value.lower())\n            else:\n                msg = f\"Icon name must be a string, got {type(tag_var)}\"\n                raise TypeError(msg)\n        elif isinstance(tag_var, Var):\n            tag_stringified = tag_var.guess_type()\n            if not isinstance(tag_stringified, StringVar):\n                msg = f\"Icon name must be a string, got {tag_var._var_type}\"\n                raise TypeError(msg)\n            return DynamicIcon.create(name=tag_stringified.replace(\"_\", \"-\"), **props)\n\n        if tag not in LUCIDE_ICON_LIST:\n            icons_sorted = sorted(\n                LUCIDE_ICON_LIST,","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-components-lucide/src/reflex_components_lucide/icon.py#L44-L80","documentation":"The lucide Icon component requires an icon name, either as the single positional child or the `tag` keyword argument. Without it there is no SVG to render, so Reflex raises AttributeError at creation time rather than silently rendering nothing.","triggerScenarios":"rx.icon() with no arguments, or rx.icon(size=20, color='red') with only keyword props and no name.","commonSituations":"Building icon props dynamically and accidentally dropping the name; refactoring that renames `tag` to something else.","solutions":["Pass the name positionally: rx.icon('home')","Or pass it explicitly: rx.icon(tag='home')"],"exampleFix":"# before\nrx.icon(size=20)\n# after\nrx.icon('home', size=20)","handlingStrategy":"validation","validationCode":"assert icon_name, 'icon name required'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include the icon name when building icon props dynamically"],"tags":["reflex","lucide","icon","missing-argument"],"backgroundTag":"missing-required-prop","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}