Meituan-Dianping/mpvue · warning
Duplicate presence of slot "${name}" found in the same rende
Error message
Duplicate presence of slot "${name}" found in the same render tree - this will likely cause render errors. What it means
Slot content vnodes are memoized with a `_rendered` flag; `$slots`/`renderSlot` checks it before re-rendering. If the same named slot's vnodes appear twice in one render tree, the second use triggers this warning because reusing the same vnode instances in multiple places corrupts the patch.
Source
Thrown at packages/weex-vue-framework/factory.js:3857
*/
function renderSlot (
name,
fallback,
props,
bindObject
) {
var scopedSlotFn = this.$scopedSlots[name];
if (scopedSlotFn) { // scoped slot
props = props || {};
if (bindObject) {
props = extend(extend({}, bindObject), props);
}
return scopedSlotFn(props) || fallback
} else {
var slotNodes = this.$slots[name];
// warn duplicate slot usage
if (slotNodes && process.env.NODE_ENV !== 'production') {
slotNodes._rendered && warn(
"Duplicate presence of slot \"" + name + "\" found in the same render tree " +
"- this will likely cause render errors.",
this
);
slotNodes._rendered = true;
}
return slotNodes || fallback
}
}
/* */
/**
* Runtime helper for resolving filters
*/
function resolveFilter (id) {
return resolveAsset(this.$options, 'filters', id, true) || identity
}View on GitHub (pinned to 6c5d78ee04)
Solutions
- Render each named slot only once per component template; restructure so the slot content appears in a single place.
- If the content must appear twice, use a scoped slot or render the content via a method that creates fresh vnodes each call.
- Duplicate the slot usage in the parent: pass the same markup through two distinct slots.
- Clone vnodes explicitly with `cloneVNode` if you truly need the same content in two places.
Example fix
// before <header><slot name="title"/></header> <footer><slot name="title"/></footer> // after <header><slot name="title"/></header> <footer><slot name="footerTitle"/></footer>
Defensive patterns
Strategy: validation
Validate before calling
// in dev, detect a slot consumed more than once in the same component
const used = new Set();
function useSlotOnce(name) {
if (used.has(name)) console.warn(`slot "${name}" rendered twice`);
used.add(name);
return this.$slots[name];
} Type guard
function slotAlreadyRendered(slotNodes) {
return !!slotNodes || (slotNodes && slotNodes._rendered === true);
} Prevention
- Render each named slot exactly once per template.
- Use scoped slots or cloneVNode when the same content must appear twice.
- Audit HOC/wrapper components for double slot consumption.
When it happens
Trigger: Referencing the same `<slot name="x">` (or `<slot>` default) twice within a component's template; wrapping a component that renders a slot and also rendering the slot again in the same parent; conditional branches in the same tree both consuming the same slot nodes.
Common situations: Layout components rendering a header slot in both a desktop and a mobile branch; a component that clones itself (e.g. tooltip + inline render) each consuming the parent slot; HOCs double-rendering children.
Related errors
- Avoid using observed data object as vnode data: ${JSON.strin
- Avoid using non-primitive value as key, use string/number va
- $props is readonly.
- Avoid mutating an injected value directly since the changes
- Injection "${key}" not found
AI-assisted analysis of Meituan-Dianping/mpvue@6c5d78ee04 (2026-09-02).
Data as JSON: /api/errors/4e54c68304b544ef.
Report an issue: GitHub.