{"record":{"id":"1277e18048ce3049","repo":"marmelab/react-admin","slug":"status-should-be-defined","errorCode":null,"errorMessage":"Status should be defined","messagePattern":"Status should be defined","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/ra-core/src/core/useConfigureAdminRouterFromChildren.tsx","lineNumber":92,"sourceCode":"    permissions: any,\n    isLoading: boolean\n): [RoutesAndResources, AdminRouterStatus] => {\n    // Gather custom routes and resources that were declared as direct children of CoreAdminRouter\n    // e.g. Not returned from the child function (if any)\n    // We need to know right away whether some resources were declared to correctly\n    // initialize the status at the next stop\n    const doLogout = useLogout();\n    const [routesAndResources, setRoutesAndResources, mergeRoutesAndResources] =\n        useRoutesAndResourcesState(getRoutesAndResourceFromNodes(children));\n\n    const [status, setStatus] = useState<AdminRouterStatus>(() =>\n        getStatus({\n            children,\n            ...routesAndResources,\n        })\n    );\n    if (!status) {\n        throw new Error('Status should be defined');\n    }\n\n    useEffect(() => {\n        const resolveChildFunction = async (\n            childFunc: RenderResourcesFunction\n        ) => {\n            try {\n                const childrenFuncResult = childFunc(permissions);\n                if ((childrenFuncResult as Promise<ReactNode>)?.then) {\n                    (childrenFuncResult as Promise<ReactNode>).then(\n                        resolvedChildren => {\n                            mergeRoutesAndResources(\n                                getRoutesAndResourceFromNodes(resolvedChildren)\n                            );\n                            setStatus('ready');\n                        }\n                    );\n                } else {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-core/src/core/useConfigureAdminRouterFromChildren.tsx#L74-L110","documentation":"useRoutesAndResourcesFromChildren (internal hook powering <Admin>'s route/resource resolution) computes a `status` from its children ('empty', 'loading', 'configuring'...). getStatus is expected to always yield a status; if it somehow returns undefined, this defensive error is thrown. It indicates the status computation returned nothing valid.","triggerScenarios":"An edge case in getStatus where the children/routesAndResources combination yields no known status — e.g. an unexpected child type passed to <Admin> (a function child or raw string), or a race where routesAndResources are being computed asynchronously and return an unhandled shape. As a defensive invariant it is rare and usually signals passing unusual children.","commonSituations":"Passing non-Resource/non-CustomRoutes children (strings, functions, arrays with unexpected elements) directly to <Admin>; using the internal hook directly in a custom admin composition; version mismatches where getStatus logic changed.","solutions":["Only pass <Resource>, <CustomRoutes>, or function-returning-these as <Admin> children","If building a custom admin with this internal hook, ensure getStatus inputs (children + routesAndResources) match the documented shapes","Upgrade or align versions of ra-core packages so getStatus and the hook come from the same version"],"exampleFix":"// before\n<Admin dataProvider={dp}>Some text</Admin>\n// after\n<Admin dataProvider={dp}>\n  <Resource name=\"posts\" list={PostList} />\n</Admin>","handlingStrategy":"validation","validationCode":"// Ensure only valid children are passed to <Admin>\nconst isValidAdminChild = (child) =>\n  isValidElement(child) &&\n  [Resource.displayName, CustomRoutes.displayName].includes(child.type?.displayName ?? child.type?.name);","typeGuard":"import { isValidElement } from 'react';\nconst isAdminChild = (child) => isValidElement(child) && (child.type === Resource || child.type === CustomRoutes);","tryCatchPattern":null,"preventionTips":["Pass only <Resource>, <CustomRoutes>, or functions returning them as <Admin> children","Avoid using internal hooks like useRoutesAndResourcesFromChildren in custom code","Keep ra-core package versions aligned so getStatus and callers match"],"tags":["react-admin","internal","routing","invariant"],"backgroundTag":"unexpected-state-invariant","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}