{"record":{"id":"9f4a0db9fa34603d","repo":"reflex-dev/reflex","slug":"f-formcontrol-can-only-have-at-most-one-child-got","errorCode":null,"errorMessage":"f\"FormControl can only have at most one child, got {len(children)} children\"","messagePattern":"f\"FormControl can only have at most one child, got (.+?) children\"","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/reflex-components-radix/src/reflex_components_radix/primitives/form.py","lineNumber":108,"sourceCode":"\n    @classmethod\n    def create(cls, *children, **props):\n        \"\"\"Create a Form Control component.\n\n        Args:\n            *children: The children of the form.\n            **props: The properties of the form.\n\n        Returns:\n            The form control component.\n\n        Raises:\n            ValueError: If the number of children is greater than 1.\n            TypeError: If a child exists but it is not a TextFieldInput.\n        \"\"\"\n        if len(children) > 1:\n            msg = f\"FormControl can only have at most one child, got {len(children)} children\"\n            raise ValueError(msg)\n        for child in children:\n            if not isinstance(child, (TextFieldRoot, DebounceInput)):\n                msg = \"Only Radix TextFieldRoot and DebounceInput are allowed as children of FormControl\"\n                raise TypeError(msg)\n        return super().create(*children, **props)\n\n\nLiteralMatcher = Literal[\n    \"badInput\",\n    \"patternMismatch\",\n    \"rangeOverflow\",\n    \"rangeUnderflow\",\n    \"stepMismatch\",\n    \"tooLong\",\n    \"tooShort\",\n    \"typeMismatch\",\n    \"valid\",\n    \"valueMissing\",","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-components-radix/src/reflex_components_radix/primitives/form.py#L90-L126","documentation":"Radix's high-level rx.form_control wraps exactly one input field (a TextFieldRoot or DebounceInput). Passing two or more children — e.g. a label plus an input plus a description — is rejected because the theme component expects its slots via props, not children.","triggerScenarios":"rx.form_control(rx.text('Name'), rx.text_field.root(...)) or any call with 2+ positional children.","commonSituations":"Porting raw radix form markup where FormControl visibly contains label/input/help-text; assuming it behaves like rx.form with free-form children.","solutions":["Keep one child: rx.form_control(rx.text_field.root(rx.text_field.input()))","Put label/description in dedicated slots (label=..., helper_text=... style props) instead of extra children","Use the lower-level radix primitives if arbitrary layout is needed"],"exampleFix":"# before\nrx.form_control(rx.text('Email'), rx.text_field.root(rx.text_field.input()))\n# after\nrx.form_control(\n    rx.text_field.root(rx.text_field.input(), type='email'),\n    label='Email',\n)","handlingStrategy":"validation","validationCode":"assert len(children) <= 1, 'form_control takes at most one child'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use form_control props for labels/help text instead of children"],"tags":["reflex","radix","form-control","children-validation"],"backgroundTag":"component-child-type-mismatch","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}