Foundry376/Mailspring · error
Menu parent did not return an itemKey for item
Error message
Menu parent did not return an itemKey for item
What it means
Warning while rendering Menu items: the parent's itemKey prop returned a falsy key (undefined/'') for an item, so React has no stable identity for the row and selection state (selectedItemKey) cannot round-trip. The menu still renders, but keyboard selection and highlighting misbehave.
Source
Thrown at app/src/components/menu.tsx:405
const items = (this.props.items || []).map((item, i) => {
const content = this.props.itemContent(item);
if (React.isValidElement(content) && content.type === MenuItem) {
return content;
}
const onMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {
event.preventDefault();
const key = this.props.itemKey(item);
this.setState({ selectedIndex: i, selectedItemKey: key });
if (this.props.onSelect) {
return this.props.onSelect(item);
}
};
const key = this.props.itemKey(item);
if (!key) {
console.warn('Menu parent did not return an itemKey for item', item);
}
if (seenItemKeys[key]) {
console.warn({ 'Menu items have colliding keys': item }, seenItemKeys[key]);
}
seenItemKeys[key] = item;
return (
<MenuItem
key={key}
id={this.props.listboxId ? `${this.props.listboxId}-option-${key}` : undefined}
role={this.props.listboxId ? 'option' : undefined}
onMouseDown={onMouseDown}
checked={this.props.itemChecked && this.props.itemChecked(item)}
content={content}
selected={this.state.selectedIndex === i}
suppressAriaSelected={!!this.props.onActiveDescendantChange}
/>
);View on GitHub (pinned to 648c685d60)
Solutions
- Fix the itemKey callback to return a unique non-empty string/id for every item
- Filter out empty placeholder items before passing them to Menu
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at app/src/components/menu.tsx:405 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Foundry376/Mailspring@648c685d60 (2026-09-03).
Data as JSON: /api/errors/22ec1af86a9f0bdd.
Report an issue: GitHub.