{"record":{"id":"673146783361215a","repo":"marmelab/react-admin","slug":"translatablefields-was-called-outside-of-a-resou","errorCode":null,"errorMessage":"<TranslatableFields> was called outside of a ResourceContext and without a record prop. You must set the resource prop.","messagePattern":"<TranslatableFields> was called outside of a ResourceContext and without a record prop\\. You must set the resource prop\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ra-ui-materialui/src/field/TranslatableFields.tsx","lineNumber":95,"sourceCode":"    });\n    const {\n        defaultLocale,\n        locales,\n        groupKey = '',\n        selector = <TranslatableFieldsTabs groupKey={groupKey} />,\n        children,\n        className,\n        resource: resourceProp,\n    } = props;\n    const record = useRecordContext(props);\n    if (!record) {\n        throw new Error(\n            `<TranslatableFields> was called outside of a RecordContext and without a record prop. You must set the record prop.`\n        );\n    }\n    const resource = useResourceContext(props);\n    if (!resource) {\n        throw new Error(\n            `<TranslatableFields> was called outside of a ResourceContext and without a record prop. You must set the resource prop.`\n        );\n    }\n    const context = useTranslatable({ defaultLocale, locales });\n\n    return (\n        <Root className={className}>\n            <TranslatableContextProvider value={context}>\n                {selector}\n                {locales.map(locale => (\n                    <TranslatableFieldsTabContent\n                        key={locale}\n                        locale={locale}\n                        record={record}\n                        resource={resourceProp}\n                        groupKey={groupKey}\n                    >\n                        {children}","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-ui-materialui/src/field/TranslatableFields.tsx#L77-L113","documentation":"Besides a record, <TranslatableFields> needs a resource to resolve labels and field sources per locale. It reads the resource from ResourceContext or a `resource` prop; when both are missing it throws (note the error message says 'record prop' but the check is for the resource).","triggerScenarios":"Rendering <TranslatableFields> with a record available but outside any ResourceContext (e.g. custom page, test) and without a `resource` prop.","commonSituations":"Using TranslatableFields inside RecordContextProvider but outside <Resource> routes; renaming a resource; rendering in a dashboard/custom route where ResourceContext isn't set.","solutions":["Pass the `resource` prop: `<TranslatableFields resource=\"posts\" locales={...}>`.","Render inside a context that provides ResourceContext (inside <Resource> routes or `<ResourceContextProvider value=\"posts\">`)."],"exampleFix":"// before\n<RecordContextProvider value={record}>\n  <TranslatableFields locales={['en', 'fr']}>...</TranslatableFields>\n</RecordContextProvider>\n\n// after\n<RecordContextProvider value={record}>\n  <TranslatableFields resource=\"posts\" locales={['en', 'fr']}>...</TranslatableFields>\n</RecordContextProvider>","handlingStrategy":"validation","validationCode":"if (!resource) throw new Error('TranslatableFields requires resource prop or ResourceContext');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use TranslatableFields inside <Resource> routes, or pass resource explicitly.","Wrap standalone usage in <ResourceContextProvider value={resourceName}>."],"tags":["react-admin","translatable-fields","resource-context","i18n"],"backgroundTag":"missing-context-provider","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}