marmelab/react-admin · error · Error
InPlaceEditor requires either a source prop or children or e
Error message
InPlaceEditor requires either a source prop or children or editor prop
What it means
InPlaceEditor must know what to render and where to write the edited value. It needs either a source prop (edit a record field), children (a react-admin input to edit with), or an explicit editor prop; without any of the three it throws immediately at render because the component cannot function.
Source
Thrown at packages/ra-ui-materialui/src/input/InPlaceEditor/InPlaceEditor.tsx:93
/>
) : null,
editor = source ? (
<TextInput
source={source}
size="small"
margin="none"
label={false}
variant="standard"
autoFocus
helperText={false}
/>
) : null,
showButtons,
notifyOnSuccess,
} = props;
if (!source && !children && !editor) {
throw new Error(
'InPlaceEditor requires either a source prop or children or editor prop'
);
}
if (mutationMode === 'undoable' && !notifyOnSuccess) {
throw new Error(
'InPlaceEditor requires notifyOnSuccess to be true when mutationMode is undoable'
);
}
const submitButtonRef = useRef<HTMLButtonElement>(null);
const [state, dispatch] = useReducer<
(
state: InPlaceEditorValue,
action: InPlaceEditorAction
) => InPlaceEditorValue
>(
(_, action) => {View on GitHub (pinned to 051f511bb0)
Solutions
- Add a source prop pointing at the record field, e.g. <InPlaceEditor source="title" />
- Or pass children with an input component, e.g. <InPlaceEditor><TextInput source="title" /></InPlaceEditor>
- Or pass an explicit editor element via the editor prop
Example fix
// before <InPlaceEditor /> // after <InPlaceEditor source="title" />
Defensive patterns
Strategy: validation
Validate before calling
if (!source && !children && !editor) {
throw new Error('InPlaceEditor requires source, children or editor');
} Type guard
const isInPlaceEditorConfigured = (
p: InPlaceEditorProps
): p is InPlaceEditorProps & ({ source: string } | { children: React.ReactNode } | { editor: React.ReactElement }) =>
p.source != null || p.children != null || p.editor != null; Try / catch
try {
render(<InPlaceEditor {...props} />);
} catch (e) {
if (e.message.includes('InPlaceEditor requires')) {
console.error('InPlaceEditor misconfigured:', e.message);
}
} Prevention
- Always configure InPlaceEditor with at least one of source/children/editor at the call site
- If building a wrapper, make one of the three props required in its TypeScript signature
- Render InPlaceEditor only inside RecordContext so source resolves to a real field
When it happens
Trigger: <InPlaceEditor /> rendered with none of source, children, or editor props defined.
Common situations: Creating an in-place editable field and forgetting to wire it to the record, or refactoring away children/source without adding the replacement prop.
Related errors
- useReferenceFieldController: missing reference prop. You mus
- useShowController requires an id prop or a route with an /:i
- useNextPrevController was called outside of a ResourceContex
- To create a new option, you must pass an onCreate function o
- <InfiniteListBase> requires either a 'render' prop or 'child
AI-assisted analysis of marmelab/react-admin@051f511bb0 (2026-08-30).
Data as JSON: /api/errors/335cd25604b677ff.
Report an issue: GitHub.