{"record":{"id":"6907625d0db7327c","repo":"marmelab/react-admin","slug":"translatablefieldstabcontent-was-called-outside","errorCode":null,"errorMessage":"<TranslatableFieldsTabContent> was called outside of a ResourceContext and without a record prop. You must set the resource prop.","messagePattern":"<TranslatableFieldsTabContent> 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/TranslatableFieldsTabContent.tsx","lineNumber":45,"sourceCode":"        props: inProps,\n        name: PREFIX,\n    });\n    const {\n        children,\n        groupKey = '',\n        locale,\n        record,\n        resource: resourceProp,\n        className,\n        ...other\n    } = props;\n    const { selectedLocale, getRecordForLocale } = useTranslatableContext();\n    const addLabel = Children.count(children) > 1;\n\n    const parentSourceContext = useOptionalSourceContext();\n    const resource = useResourceContext(props);\n    if (!resource) {\n        throw new Error(\n            `<TranslatableFieldsTabContent> was called outside of a ResourceContext and without a record prop. You must set the resource prop.`\n        );\n    }\n    const sourceContext = useMemo(\n        () => ({\n            getSource: (source: string) =>\n                parentSourceContext\n                    ? parentSourceContext.getSource(`${source}.${locale}`)\n                    : `${source}.${locale}`,\n            getLabel: (source: string) =>\n                parentSourceContext\n                    ? parentSourceContext.getLabel(source)\n                    : getResourceFieldLabelKey(resource, source),\n        }),\n        [locale, parentSourceContext, resource]\n    );\n    // As fields rely on the RecordContext to get their values and have no knowledge of the locale,\n    // we need to create a new record with the values for the current locale only","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-ui-materialui/src/field/TranslatableFieldsTabContent.tsx#L27-L63","documentation":"<TranslatableFieldsTabContent> is the internal content renderer of TranslatableFields tabs; it needs the resource from ResourceContext (or a `resource` prop) to resolve sources/labels for the active locale. Without it, it throws (the message mentions 'record prop' but the failing check is the missing resource).","triggerScenarios":"Rendering <TranslatableFieldsTabContent> manually outside a TranslatableFields/ResourceContext, without a `resource` prop; constructing custom translatable tabs without wrapping in ResourceContextProvider.","commonSituations":"Building a custom TranslatableFields-like component reusing the tab content; rendering the component in tests/storybook without resource context; refactoring TranslatableFields and bypassing its internals.","solutions":["Pass a `resource` prop to <TranslatableFieldsTabContent>.","Wrap it in <ResourceContextProvider value=\"posts\"> so useResourceContext finds the resource.","Prefer using <TranslatableFields> itself rather than rendering TabContent directly."],"exampleFix":"// before\n<TranslatableFieldsTabContent locale=\"en\">...</TranslatableFieldsTabContent>\n\n// after\n<ResourceContextProvider value=\"posts\">\n  <TranslatableFieldsTabContent locale=\"en\">...</TranslatableFieldsTabContent>\n</ResourceContextProvider>","handlingStrategy":"validation","validationCode":"if (!resource) return null; // ensure ResourceContext or resource prop exists before rendering tab content","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use <TranslatableFields> instead of rendering TranslatableFieldsTabContent directly.","Supply ResourceContextProvider when composing custom translatable UIs."],"tags":["react-admin","translatable-fields","resource-context","internal-component"],"backgroundTag":"missing-context-provider","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}