Help:Cite errors/Cite error references duplicate key

Overview
If you are going to reference the same source multiple times, Wikipedia allows you to name those sources so you can just refer to a source named "foo" rather than having to recreate all of the details about the citation (the author, the title, etc.) over and over. The name is created like this:
 * content

Then, to invoke that footnote you have named foo, just type this:

The content (the details of the citation) of the reference that has been named "foo" is thus defined only once but can be reused over and over.

Issues and resolution
The error happens when a named reference is defined multiple times with different content. For example, first content1 and later content2, where  is repeated but content1 and content2 are different. The purpose of named references is to be able to invoke them elsewhere with, 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  instead of. If the reference is not meant to be invoked elsewhere then it can also be made unnamed by removing, but this is not necessary.

If the references are meant to be the same then replace one of the definitions by 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 content or content. Ref names should not be empty. Either add a name or remove.

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

See also Technical Templates below.

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.

Sfn
If two or more calls to 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   vs , or a use of   in one but not the other, this issue will arise.

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

Nested footnotes
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:

Removing the inner reference will fix the error.

Examples
Here the reference named ipsum was defined twice, but the second definition's content differs from the first (only the first definition is taken): {{pre| Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Templates
In order to include variable data within a reference tag such as, the   parser function must be used. Currently  only supports balanced tags, not a singular tag, thus   cannot normally be used in a template unless the element is hard coded.

However, Cite has been modified since 2008 to treat  identically to. Note that there cannot be even a space between the  and the , otherwise this will result in definition of the reference named "ref-foo" to be " ", which if meant to be second reference by name to an existing reference will cause a duplicate definition error. Correct code to produce a singular tag will look like, that is, no space between the two "|"s.