Meituan-Dianping/mpvue · error
duplicate attribute: ${attrs[i].name}
Error message
duplicate attribute: ${attrs[i].name} What it means
Dev-only warning from makeAttrsMap during template parsing: the same attribute name appears more than once on a single element (IE/Edge parsing artifacts are exempted). The later value overwrites the earlier in the attribute map, so the warning flags markup whose behavior likely differs from author intent.
Source
Thrown at src/compiler/parser/index.js:554
}
function parseModifiers (name: string): Object | void {
const match = name.match(modifierRE)
if (match) {
const ret = {}
match.forEach(m => { ret[m.slice(1)] = true })
return ret
}
}
function makeAttrsMap (attrs: Array<Object>): Object {
const map = {}
for (let i = 0, l = attrs.length; i < l; i++) {
if (
process.env.NODE_ENV !== 'production' &&
map[attrs[i].name] && !isIE && !isEdge
) {
warn('duplicate attribute: ' + attrs[i].name)
}
map[attrs[i].name] = attrs[i].value
}
return map
}
// for script (e.g. type="x/template") or style, do not decode content
function isTextTag (el): boolean {
return el.tag === 'script' || el.tag === 'style'
}
function isForbiddenTag (el): boolean {
return (
el.tag === 'style' ||
(el.tag === 'script' && (
!el.attrsMap.type ||
el.attrsMap.type === 'text/javascript'
))View on GitHub (pinned to 6c5d78ee04)
Solutions
- Deduplicate the attribute on the element named in the warning
- Merge values into one attribute (e.g. combine classes)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/compiler/parser/index.js:554 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Meituan-Dianping/mpvue@6c5d78ee04 (2026-09-02).
Data as JSON: /api/errors/f4d2cc6d6e73ed2e.
Report an issue: GitHub.