{"record":{"id":"5335d8119e9ea049","repo":"marmelab/react-admin","slug":"the-admin-is-empty-please-provide-an-empty-compon","errorCode":null,"errorMessage":"The admin is empty. Please provide an empty component, or pass Resource or CustomRoutes as children.","messagePattern":"The admin is empty\\. Please provide an empty component, or pass Resource or CustomRoutes as children\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/ra-core/src/core/CoreAdminRoutes.tsx","lineNumber":47,"sourceCode":"        catchAll: CatchAll,\n        dashboard,\n        loading: LoadingPage,\n        requireAuth,\n        ready: Ready,\n        authenticationError: AuthenticationError = Noop,\n        accessDenied: AccessDenied = Noop,\n    } = props;\n\n    const { authenticated, isPending: isPendingAuthenticated } = useAuthState(\n        undefined,\n        // do not log the user out on failure to allow access to custom routes with no layout\n        false,\n        { enabled: requireAuth }\n    );\n\n    if (status === 'empty') {\n        if (!Ready) {\n            throw new Error(\n                'The admin is empty. Please provide an empty component, or pass Resource or CustomRoutes as children.'\n            );\n        }\n        return <Ready />;\n    }\n\n    // Note: custom routes with no layout are always rendered, regardless of the auth status\n\n    if (status === 'loading' || (requireAuth && isPendingAuthenticated)) {\n        return (\n            <Routes>\n                {customRoutesWithoutLayout}\n                <Route\n                    path=\"*\"\n                    element={\n                        <div style={{ height: '100vh' }}>\n                            <LoadingPage />\n                        </div>","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-core/src/core/CoreAdminRoutes.tsx#L29-L65","documentation":"CoreAdminRoutes computes the routes/resources from the <Admin>'s children; status 'empty' means no Resource or CustomRoutes children were found. If no `Ready`/`empty` component (e.g. <Ready> or the admin `empty` prop) is configured, react-admin throws because it has nothing to route to.","triggerScenarios":"Rendering <Admin dataProvider={...}> with zero children (no <Resource>, no <CustomRoutes>); all children provided asynchronously via a renderResources function that returns an empty array on first render while no `empty`/`Ready` component is set; children being conditionally removed by auth/permissions checks.","commonSituations":"Setting up an admin gradually (dataProvider first, resources later); permission-based menus where user has no access so all Resources are filtered out; dynamic resource registration that resolves empty; typo'd children (e.g. fragments resolving to nothing).","solutions":["Add at least one child: <Resource name=\"posts\" list={PostList} />","Pass the `empty` prop (or Ready component) to <Admin empty={...}> to handle legitimately empty admins","If resources load asynchronously, render a loading state or ensure the resolve function returns before status becomes 'empty' without resources","Check that permission logic is not filtering out all resources unintentionally"],"exampleFix":"// before\n<Admin dataProvider={dp} />\n// after\n<Admin dataProvider={dp}>\n  <Resource name=\"posts\" list={PostList} />\n</Admin>","handlingStrategy":"fallback","validationCode":"const hasChildren = (children) => React.Children.count(React.Children.toArray(children).filter(Boolean)) > 0;\nif (!hasChildren(resources)) {\n  return <Admin dataProvider={dp} empty={<NoResources />}>...</Admin>;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Register at least one <Resource> as an <Admin> child","Set the `empty` prop on <Admin> to handle legitimately empty admins","Audit permission-based resource filtering so it cannot remove every resource","Provide loading states while dynamic resources resolve"],"tags":["react-admin","configuration","routing","empty-children"],"backgroundTag":"missing-required-prop","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}