marmelab/react-admin · error · Error
If you're not wrapping the RadioButtonGroupInput inside a…
Error message
If you're not wrapping the RadioButtonGroupInput inside a ReferenceArrayInput, you must provide the source prop
What it means
RadioButtonGroupInput resolves source and choices through useChoicesContext. Outside a ReferenceInput-like parent, source must be supplied explicitly so the component can register the field with the form; missing source means an unbindable input, so it throws at render time.
Solutions
- Add the source prop: <RadioButtonGroupInput source="gender" choices={[...]} />
- Or wrap it in a ReferenceInput that supplies the source via context
Example fix
// before
<RadioButtonGroupInput choices={genderChoices} />
// after
<RadioButtonGroupInput source="gender" choices={genderChoices} /> Defensive patterns
Strategy: validation
Validate before calling
if (source === undefined) {
throw new Error('RadioButtonGroupInput requires a source prop (or a ReferenceInput parent)');
} Type guard
const hasSource = (
p: RadioButtonGroupInputProps
): p is RadioButtonGroupInputProps & { source: string } =>
typeof p.source === 'string' && p.source.length > 0; Try / catch
try {
render(<RadioButtonGroupInput {...props} />);
} catch (e) {
if (e.message.includes('must provide the source prop')) {
console.error('RadioButtonGroupInput misconfigured:', e.message);
}
} Prevention
- Pass source explicitly for standalone usage
- Check prop name typos (source vs sources vs name)
- Make wrapper components require source in their prop types
When it happens
Trigger: Rendering <RadioButtonGroupInput /> without a source prop and without a parent ReferenceInput providing one.
Common situations: Moving the input out of a ReferenceInput wrapper during a refactor, conditional prop spreading leaving source undefined, or a typo in the prop name (e.g. sources).
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- If you're not wrapping the RadioButtonGroupInput inside a…
- components should be used inside a component or provided…
- requires either a `render` prop or `children` prop
- components should be used inside a component or provided…
- DatagridRow expects an id prop
AI-assisted analysis of marmelab/react-admin@051f511bb0 (2026-08-30).
Data as JSON: /api/errors/8cbd4d29d1fa735f.
Report an issue: GitHub.
Appendix: source
Thrown at packages/ra-ui-materialui/src/input/RadioButtonGroupInput.tsx:158
const {
allChoices,
isPending,
error: fetchError,
resource,
source,
isFromReference,
} = useChoicesContext({
choices: choicesProp,
isFetching: isFetchingProp,
isLoading: isLoadingProp,
isPending: isPendingProp,
resource: resourceProp,
source: sourceProp,
});
if (source === undefined) {
throw new Error(
`If you're not wrapping the RadioButtonGroupInput inside a ReferenceArrayInput, you must provide the source prop`
);
}
if (!isPending && !fetchError && allChoices === undefined) {
throw new Error(
`If you're not wrapping the RadioButtonGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
);
}
const { id, isRequired, fieldState, field } = useInput({
format,
onBlur,
onChange,
parse,
resource,
source,
validate,View on GitHub (pinned to 051f511bb0)