Meituan-Dianping/mpvue · error

duplicate attribute: ${attrs[i].name}

Error message

duplicate attribute: ${attrs[i].name}

What it means

Dev-only compiler warning from makeAttrsMap while building the attribute map during template parsing: the same attribute name appears more than once on one element. Later duplicates silently overwrite earlier ones, so the warning flags a template that likely does not do what the author intended.

Source

Thrown at packages/weex-template-compiler/build.js:1866

}

function parseModifiers (name) {
  var match = name.match(modifierRE);
  if (match) {
    var ret = {};
    match.forEach(function (m) { ret[m.slice(1)] = true; });
    return ret
  }
}

function makeAttrsMap (attrs) {
  var map = {};
  for (var 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) {
  return el.tag === 'script' || el.tag === 'style'
}

function isForbiddenTag (el) {
  return (
    el.tag === 'style' ||
    (el.tag === 'script' && (
      !el.attrsMap.type ||
      el.attrsMap.type === 'text/javascript'
    ))

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Remove the duplicate attribute so each name appears once on the element
  2. Merge intended values (e.g. combine class lists) into a single attribute
  3. Note: duplicates caused by IE/Edge parsing quirks are exempted in the check
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/weex-template-compiler/build.js:1866 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/0c6d44a0254c0cbe. Report an issue: GitHub.