XML error · InvalidAttr
Attribute is repeated
The same attribute name appears twice on one element, which XML forbids outright.
Attribute 'href' is repeated.What it means
An element may not carry the same attribute name twice. Unlike HTML, where a browser silently keeps the first, XML treats it as a well-formedness error and refuses the document.
In namespaced documents the rule applies after prefix resolution, so two different prefixes bound to the same URI count as a duplicate even though the text differs.
What usually causes it
- A merge that applied the same attribute from two sources.
- A template that adds a default attribute and then adds it again conditionally.
- Two prefixes bound to one namespace URI, colliding after resolution.
- Hand-editing that duplicated an attribute rather than replacing it.
How to fix it
- Remove the duplicate; decide deliberately which value wins.
- Build attributes in a map keyed by expanded name so collisions are impossible.
- Check for two prefixes bound to the same namespace URI.
The same error elsewhere
Different parsers, same defect. If you arrived with one of these messages, you are in the right place.
Xerces (Java)
Attribute "href" was already specified for element "link".libxml2 (PHP, lxml, Nokogiri)
Attribute href redefinedexpat (Python)
duplicate attribute: line 1, column 30.NET System.Xml
'href' is a duplicate attribute name.
Before and after
Both snippets are checked on every build: the first is confirmed to produce the error above, the second to parse cleanly.
<link rel="alternate" href="https://example.com/a" href="https://example.com/b"/><link rel="alternate" href="https://example.com/b"/>Where this bites most
Other XML errors
- Expected closing tag
- Unclosed tag
- Closing tag has not been opened
- Character is not expected
- Start tag expected
- XML declaration allowed only at the start of the document
- Attribute is without value (unquoted attribute value)
- Attributes have open quote
- Tag is an invalid name
- Invalid tags found (open elements at end of input)
Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.