{"record":{"id":"80005ac2a0a35120","repo":"marmelab/react-admin","slug":"missing-dataprovider-prop-react-admin-requires-a","errorCode":null,"errorMessage":"Missing dataProvider prop.\nReact-admin requires a valid dataProvider function to work.","messagePattern":"Missing dataProvider prop\\.\nReact-admin requires a valid dataProvider function to work\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"packages/ra-core/src/core/CoreAdminContext.tsx","lineNumber":206,"sourceCode":"     * );\n     */\n    routerProvider?: RouterProvider;\n}\n\nexport const CoreAdminContext = (props: CoreAdminContextProps) => {\n    const {\n        authProvider,\n        basename,\n        dataProvider = defaultDataProvider,\n        i18nProvider,\n        store = defaultStore,\n        children,\n        queryClient,\n        routerProvider = reactRouterProvider,\n    } = props;\n\n    if (!dataProvider) {\n        throw new Error(`Missing dataProvider prop.\nReact-admin requires a valid dataProvider function to work.`);\n    }\n\n    const finalQueryClient = useMemo(\n        () => queryClient || new QueryClient(),\n        [queryClient]\n    );\n\n    const finalAuthProvider = useMemo(\n        () =>\n            authProvider instanceof Function\n                ? convertLegacyAuthProvider(authProvider)\n                : authProvider,\n        [authProvider]\n    );\n\n    const finalDataProvider = useMemo(\n        () =>","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-core/src/core/CoreAdminContext.tsx#L188-L224","documentation":"React-admin's CoreAdminContext requires a `dataProvider` prop — the adapter that talks to your API (fetch, REST, GraphQL, local). Without it no data query can run, so the library throws immediately when the admin renders. This is a hard requirement of the framework.","triggerScenarios":"Rendering <CoreAdminContext> or <Admin> without a dataProvider prop; passing undefined due to a failed import or async dataProvider not yet resolved (e.g. dataProvider={fetchedProvider} while still loading); conditional composition like dataProvider={process.env.X && provider} evaluating to false/undefined.","commonSituations":"Beginner setups forgetting the dataProvider; lazy-loading a dataProvider without gating the admin render; custom admin compositions (CoreAdminContext/CoreAdminRoutes used directly) missing the prop; environment variables not set so the factory returns undefined.","solutions":["Pass a dataProvider: <Admin dataProvider={simpleRestProvider('/api')}>","If the provider is created asynchronously, render the admin only after it resolves (or use a placeholder until ready)","Verify the import of the data provider package and that the factory call is not returning undefined"],"exampleFix":"// before\n<Admin>\n  <Resource name=\"posts\" />\n</Admin>\n// after\nimport simpleRestProvider from 'ra-data-simple-rest';\n<Admin dataProvider={simpleRestProvider('http://localhost:3000')}>\n  <Resource name=\"posts\" />\n</Admin>","handlingStrategy":"validation","validationCode":"if (typeof dataProvider !== 'function' && typeof dataProvider?.getList !== 'function') {\n  throw new Error('dataProvider is missing or invalid');\n}\nreturn <Admin dataProvider={dataProvider}>...</Admin>;","typeGuard":"const isDataProvider = (dp) => dp != null && typeof dp.getList === 'function' && typeof dp.getOne === 'function';","tryCatchPattern":null,"preventionTips":["Always pass a dataProvider when creating <Admin>/<CoreAdminContext>","Gate async provider creation: render admin only after the provider resolves","Verify the data-provider package import and factory call actually returns a provider object","Check env vars used to build the provider are defined"],"tags":["react-admin","configuration","dataprovider","missing-prop"],"backgroundTag":"missing-required-prop","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}