{"record":{"id":"1903ebc7540029a7","repo":"marmelab/react-admin","slug":"referencearrayinputbase-requires-either-a-rende","errorCode":null,"errorMessage":"<ReferenceArrayInputBase> requires either a 'render' prop or 'children' prop","messagePattern":"<ReferenceArrayInputBase> requires either a 'render' prop or 'children' prop","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/ra-core/src/controller/input/ReferenceArrayInputBase.tsx","lineNumber":97,"sourceCode":"export const ReferenceArrayInputBase = <RecordType extends RaRecord = any>(\n    props: ReferenceArrayInputBaseProps<RecordType>\n) => {\n    const {\n        children,\n        filter = defaultFilter,\n        offline,\n        reference,\n        render,\n        sort,\n    } = props;\n    if (children && React.Children.count(children) !== 1) {\n        throw new Error(\n            '<ReferenceArrayInputBase> only accepts a single child (like <AutocompleteArrayInput>)'\n        );\n    }\n\n    if (!render && !children) {\n        throw new Error(\n            \"<ReferenceArrayInputBase> requires either a 'render' prop or 'children' prop\"\n        );\n    }\n\n    const controllerProps = useReferenceArrayInputController({\n        ...props,\n        sort,\n        filter,\n    });\n    const { isPaused, isPending } = controllerProps;\n    // isPending is true: there's no cached data and no query attempt was finished yet\n    // isPaused is true: the query was paused (e.g. due to a network issue)\n    // Both true: we're offline and have no data to show\n    const shouldRenderOffline =\n        isPaused && isPending && offline !== undefined && offline !== false;\n\n    return (\n        <ResourceContextProvider value={reference}>","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-core/src/controller/input/ReferenceArrayInputBase.tsx#L79-L115","documentation":"ReferenceArrayInputBase requires a rendering mechanism for its selection UI: either a render prop or exactly one child input. When both are absent it throws, since the fetched choices could not be presented or wired to a form value.","triggerScenarios":"Rendering <ReferenceArrayInput source=\"tag_ids\" reference=\"tags\" /> with no child and no render prop; children provided only via a variable that is undefined/null at runtime; conditional children like {enabled && <Input/>} evaluating to false.","commonSituations":"Building a custom array input wrapper and forgetting the child; dynamic input selection that yields undefined; copying controller-only examples from the headless docs without the render layer.","solutions":["Add a single child input: <ReferenceArrayInput source=\"tag_ids\" reference=\"tags\"><AutocompleteArrayInput optionText=\"name\" /></ReferenceArrayInput>","Or provide a render prop: render={({choices, error, isPending}) => ...}","Ensure the children variable/conditional resolves to a defined element"],"exampleFix":"// before\n<ReferenceArrayInput source=\"tag_ids\" reference=\"tags\" />\n// after\n<ReferenceArrayInput source=\"tag_ids\" reference=\"tags\">\n  <AutocompleteArrayInput optionText=\"name\" />\n</ReferenceArrayInput>","handlingStrategy":"validation","validationCode":"if (props.render == null && props.children == null)\n  throw new Error('Provide render or a single child');","typeGuard":"const hasInput = (p: { render?: unknown; children?: unknown }): boolean =>\n  Boolean(p.render ?? p.children);","tryCatchPattern":"try {\n  render(<ReferenceArrayInput source=\"tag_ids\" reference=\"tags\" />);\n} catch (e) { logAndFallback(e); }","preventionTips":["Always pass one input child or render","Validate dynamic children","Prefer UI-kit wrapper","Render-test form configs"],"tags":["react-admin","props-validation","input","render-prop"],"backgroundTag":"missing-required-render-prop","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}