{"record":{"id":"51a2ee510a21c5ed","repo":"reflex-dev/reflex","slug":"f-match-did-not-return-a-var-size-map-var","errorCode":null,"errorMessage":"f\"Match did not return a Var: {size_map_var}\"","messagePattern":"f\"Match did not return a Var: (.+?)\"","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/reflex-components-radix/src/reflex_components_radix/themes/components/icon_button.py","lineNumber":88,"sourceCode":"                    Icon.create(\n                        children[0],\n                    )\n                ]\n        else:\n            msg = \"IconButton requires a child icon. Pass a string as the first child or a rx.icon.\"\n            raise ValueError(msg)\n        if \"size\" in props:\n            if isinstance(props[\"size\"], str):\n                children[0].size = RADIX_TO_LUCIDE_SIZE[props[\"size\"]]  # pyright: ignore[reportAttributeAccessIssue]\n            else:\n                size_map_var = Match.create(\n                    props[\"size\"],\n                    *list(RADIX_TO_LUCIDE_SIZE.items()),\n                    12,\n                )\n                if not isinstance(size_map_var, Var):\n                    msg = f\"Match did not return a Var: {size_map_var}\"\n                    raise ValueError(msg)\n                children[0].size = size_map_var  # pyright: ignore[reportAttributeAccessIssue]\n        return super().create(*children, **props)\n\n    def add_style(self):\n        \"\"\"Add style to the component.\n\n        Returns:\n            The style of the component.\n        \"\"\"\n        return Style({\"padding\": \"6px\"})\n\n\nicon_button = IconButton.create\n","sourceCodeStart":70,"sourceCodeEnd":102,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-components-radix/src/reflex_components_radix/themes/components/icon_button.py#L70-L102","documentation":"When icon_button's `size` prop is a Var (not a static string), Reflex builds a Match expression to map Radix sizes to lucide pixel sizes. This internal sanity check fires if Match.create somehow returns a non-Var — practically only reachable through API misuse or version mismatch between reflex-components-radix and reflex core.","triggerScenarios":"Passing size as a Var (e.g. size=State.icon_size) in an environment where the core Match API returns a non-Var, or after a partial/downgraded package upgrade.","commonSituations":"Mixed reflex package versions after a partial `uv sync`/pip install; using bleeding-edge Var types not handled by Match.create.","solutions":["Use a static size string: size='2'","If dynamic sizing is needed, apply size via CSS class/cond instead of the size prop","Re-sync workspace: uv sync to align reflex-core and reflex-components-radix versions, then retry; if it persists, report upstream"],"exampleFix":"# before\nrx.icon_button('trash', size=State.size)\n# after\nrx.icon_button('trash', size='2')","handlingStrategy":"validation","validationCode":"# use static size when possible\nrx.icon_button('trash', size='2')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep reflex-core and reflex-components-radix versions in sync via uv sync","Prefer static size strings"],"tags":["reflex","radix","icon-button","internal-invariant"],"backgroundTag":"library-version-mismatch","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}