Help:Cite errors/Cite error references duplicate key

From Wikipedia, the free encyclopedia
Jump to: navigation, search

This page will help you to fix the error message:

Invalid <ref> tag; name "$1" defined multiple times with different content (see the help page).

  • If you need help with a particular problem, please discuss it on the article talk page or at the Help desk.
  • If you have read this help page and find something missing or confusing, please discuss it at the main talk page.
  • Please reference this page and the page where you have the problem so we can understand your issues.
  • For basic information on the footnotes system, see Referencing for beginners; for advanced help, see Footnotes.

Overview[edit]

Further information: WP:REFNAME

A footnote used multiple times may be defined with a name:

<ref name="foo">content</ref>

To invoke a named footnote:

<ref name="foo" />

The content of the ref name "foo" is only defined once.

Issues and resolution[edit]

The error happens when a named reference is defined multiple times with different content. For example, first <ref name="foo">content1</ref> and later <ref name="foo">content2</ref>, where "foo" is repeated but content1 and content2 are different. The purpose of named references is to be able to invoke them elsewhere with <ref name="foo" />, but there must be a unique definition of the ref name "foo".

If the references with content1 and content2 are meant to be different then change one of the ref names, for example name="bar" instead of name="foo". If the reference is not meant to be invoked elsewhere then it can also be made unnamed by removing name="foo", but this is not necessary.

If the references are meant to be the same then replace one of the definitions by <ref name="foo" /> to invoke the other definition. It may technically work to make two identical definitions but this should not be done. It causes confusion and will recreate the error if somebody later changes one of the definitions without making the same change to the other.

The error can also happen with empty ref names like <ref name="">content</ref> or <ref name>content</ref>. Ref names should not be empty. Either add a name or remove name="".

Ref names may be generated by a template and produce names not in the wikitext. For example, {{sfn|Stokes|1979|p=2}} and {{sfn|Stokes|1979|pp=2}} may both produce references of form <ref name="FOOTNOTEStokes19792">...</ref>, causing the error message to use the ref name "FOOTNOTEStokes19792". p= is intended for a single page and pp= for a range. ps= must have the same value in each use of {{sfn}} where the other parameters are identical. An assigned value in ps= cannot be combined with an omitted ps= elsewhere on the page. If there is a blank ps= then remove it.

Whole references may be transcluded from other pages. When the "Edit" or "Edit source" tab at top of a page is clicked, the bottom of the window will say "Pages transcluded onto the current version of this page". Click the text if no list is shown. Articles are more likely than other pages to contain named references.

The ref name in the error message may have replaced spaces by underscores and converted some special characters.

Names[edit]

Names for footnotes and groups must follow these rules:

  • Names are case-sensitive
  • Names may not be purely numeric
  • Names must be unique—you cannot use the same name to define different groups or footnotes
  • Quotation marks are optional if the only characters used are letters A–Z, a–z, digits 0–9, and the symbols !$%&()*,-.:;<@[]^_`{|}~.
  • Inclusion of any other characters, including spaces, requires that the reference name be enclosed in quotes: name="John Smith" (since not all later editors will know of this technical restriction, it is safest to always put quote marks around the reference name).
  • The quote marks must be the standard straight keyboard marks ("); curly or other quotes will be parsed as part of the reference name.
  • Quote-enclosed reference names may not include a less-than sign (<) or a double straight quote symbol ("). These may be escaped with &lt; and &quot;, respectively.
  • Please consider keeping reference names simple and restricted to the standard English alphabet and numerals.
  • You may optionally provide reference names even when the reference name is not required. This makes later re-use of the sourced reference easier.

Sfn[edit]

If two or more calls to {{sfn}} use the same citation parameters, that is, if the author(s), year, and page number(s) are all identical, but there is some other difference, such as a use of pp= vs p=, or a use of ps= in one but not the other, this issue will arise.

The solution is to make the calls identical. If the ps= parameter was being used to include a quote or other extended content, use {{harvnb}} inside a <ref>...</ref> construct with the quote after the template but inside the ref tag structure.

Nested footnotes[edit]

If there are nested footnotes, i.e. a reference within another reference, then the error can occur even if two definitions have identical text. Example where {{sfn}} will create a ref name with another reference inside it:

<ref name="Buna">Advance to Buna</ref>
{{sfn|Blakeley|1956|ps=. Cited in Advance to Buna.<ref name=Buna />}}
{{sfn|Blakeley|1956|ps=. Cited in Advance to Buna.<ref name=Buna />}}

Removing the inner reference will fix the error.

References[edit]

Technical[edit]

Pages with this error message are placed into Pages with duplicate reference names. The system message page is at Cite error references duplicate key.