How do you find the location of an error?

edit

Apologies if this is a dumb question. I'm looking at a page with dozens of {{cite book templates. If you click edit and then preview you get an error at the top of the page saying one or more cite book templates has errors, and the help topic links to this page. Trouble is that I have absolutely no clue where the error or errors are. How are you supposed to figure out the error location so you can fix things? Just the first error location would be fine, then I could fix that one and go on to the next one... Efbrazil (talk) 16:53, 3 April 2024 (UTC)Reply

Error messages are not hidden so they should be visible to you. Maintenance messages (which are not errors) are hidden. You have to enable display of those messages by following the instructions at Help:CS1 errors § Controlling error message display.
Trappist the monk (talk) 17:01, 3 April 2024 (UTC)Reply
Thanks for helping Trappist. I tried adding error visibility to my css page and used shift+F5 but still don't see anything. I tried searching on the word "error" on the page after refreshing, and I tried scanning the page, but no luck. The article in question is Climate change mitigation. I only see the error warning message if I click "edit" and then "preview". Can you take a look and see if the errors are obvious to you, and if so how you see them? Efbrazil (talk) 19:26, 3 April 2024 (UTC)Reply
That article shows an error at reference #279 (Cardenas): "{{cite book}}: |journal= ignored (help)". – Jonesey95 (talk) 19:28, 3 April 2024 (UTC)Reply
Thanks! Did you find that error by visually scanning the references for red text? Since there are hundreds of references that wasn't working for me.
As a side note, it's crazy to me that the error message at the top of the page doesn't link to the first instance of the error. Efbrazil (talk) 19:34, 3 April 2024 (UTC)Reply
I use CTRL+F and search for (help) to find error messages and cs1 to find maintenance messages.
The preview messages were originally designed and implemented to link to the first instance of the error. But, for technical reasons, we could not implement it in a way that didn't violate the html standard so you have to look for the messages.
Trappist the monk (talk) 19:41, 3 April 2024 (UTC)Reply
Thanks! Why not report the first reference number that fails in the error message? Once Jonesey95 said to look at reference 279 it was all straightforward. Efbrazil (talk) 19:46, 3 April 2024 (UTC)Reply
Because each template is processed independently and there is no mechanism to allow Lua modules to 'remember' stuff from a previous call.
Trappist the monk (talk) 21:41, 3 April 2024 (UTC)Reply
Then perhaps the error message could report the first 50 characters of the offending template? Then the user can then copy and paste that text to search the textarea window. So show something like this:
Script warning: A template that begins with "{{Cite book |author1=Garrett, L. |author2=Lévite, " has errors (help).
Alternatively, if the script knows what line number the template error is on it could report that. Just give the user something! Efbrazil (talk) 16:32, 4 April 2024 (UTC)Reply
Module:Citation/CS1 does not know the actual name of the template in the wikitext; the name could be the name of a redirect. The module does not get a wikitext representation of the template; could be written in vertical or horizontal format; whitespace may or may not exist around pipes (|), around parameter names, around the assignment operator (=), around parameter values so, for the purposes of CTRL+F searching:
{{cite book |author=Author |date=Date |title=Title |location=Location |publisher=Publisher}}
is not the same as:
{{cite book | author = Author | date = Date | title = Title | location = Location | publisher = Publisher }}
is not the same as:
{{cite book|author=Author|date=Date|title=Title|location=Location|publisher=Publisher}}
is not the same as:
{{cite book
|author=Author
|date=Date
|title=Title
|location=Location
|publisher=Publisher
}}
Module:Citation/CS1 does not know the position of the template within the wikitext so cannot provide a line number.
From a rendered citation with an error or maintenance message, you can hover over the title extlink, right click > Copy link address, and then paste that into the CTRL+F search window. Doesn't work for identifier links.
Trappist the monk (talk) 21:59, 4 April 2024 (UTC)Reply
Thanks! It's clear you know this system well. Could you write a section at the beginning of the CS1 errors page giving explicit step by step instructions on how to find the error on the page? Right now there's endless description on what can cause errors, but no instructions on how to find the location of the error. Efbrazil (talk) 16:29, 5 April 2024 (UTC)Reply
Your advice:
I use CTRL+F and search for (help) to find error messages and cs1 to find maintenance messages.
That advice was precious for me too, and thank you for it; but I needed some time to find it.
I have added that your advice to the Help:CS1 errors#Error and maintenance messages section of the article, hopefully in an admissible way. If I missed something (I have put the quoted statement in blocquote, and now I see <code parameter didn't apply there so I used italic...), please correct it. Marjan Tomki SI (talk) 11:55, 31 May 2024 (UTC)Reply

Semi-protected edit request on 24 April 2024

edit

A section link is broken in Help:CS1 errors#bad_date. Where it says:

[[Help:Citation_Style_1#Date_compliance_with_Wikipedia's_Manual_of_Style|subset of the date rules]]

Change it to:

[[Help:Citation_Style_1#Date_format_compliance_with_Wikipedia's_Manual_of_Style|subset of the date rules]]

73.37.211.177 (talk) 08:28, 24 April 2024 (UTC)Reply

  Done Well spotted! -- John of Reading (talk) 09:46, 24 April 2024 (UTC)Reply

Script warning: One or more {{cite book}} templates have maintenance messages; messages may be hidden (help).

edit

This section doesn't say how to resolve the base or core issue at all. It just say, Oh, install script you don't have power to do into your wikipedia. Can we get how to resolve one of these errors because I don't see where the error is on the page and it doesn't help you to flag where the error is, which is a lot less useful that a lot of the current programs. Screw it, I'm posting it, 'cause there is no apparent error I can find in any of the citations.--KimYunmi (talk) 20:10, 9 June 2024 (UTC)Reply

See the big (help) link? Click that. Headbomb {t · c · p · b} 21:22, 9 June 2024 (UTC)Reply
If you want more specific help, you'll have to be more specific about where you're seeing that message. Headbomb {t · c · p · b} 21:28, 9 June 2024 (UTC)Reply

Season slash error

edit

date = Fall/Winter 2012 does not seem to work. [1]

jps (talk) 16:03, 12 August 2024 (UTC)Reply

Did you follow the help link that is part of the error message and read the help text? If you did and still don't know why that error message is present, tell us what it is about the help text that you don't understand so that we can improve it.
Trappist the monk (talk) 16:20, 12 August 2024 (UTC)Reply
I did. Seasons are supposed to be included. If you use date = Fall 2012, it works without error. It seems that a season of Fall/Winter is the problem. At least, that's the best I can surmise. jps (talk) 16:29, 12 August 2024 (UTC)Reply
It appears you have written the citation correctly, since that's how the date is written in the source. So just leave the error message, it's a false alarm. Jc3s5h (talk) 17:32, 12 August 2024 (UTC)Reply
Not true. The consensus for cs1|2 date handling is published at Help:Citation Style 1 § Dates where we say that the solidus is not supported in cs1|2 dates. If you leave the error readers will see it. Someday an en.wiki editor may fix it. Don't leave a mess for someone else to clean up. It is best to write the date in a way acceptable to the cs1|2 template so that others don't have to clean up after you and readers aren't exposed to our error messages.
If you believe that cs1|2 should support the solidus range separator, get consensus to do so at Help talk:Citation Style 1.
Trappist the monk (talk) 17:55, 12 August 2024 (UTC)Reply
This reply is written in a style that suggests it's better to write a false date that doesn't create an error message than to write a correct date that isn't supported. It's only by reading a different post can one find that there is, in this instance, a way to write the date in a supported way. Jc3s5h (talk) 20:42, 12 August 2024 (UTC)Reply
If the correct way to write more than one season is to use an en dash, then that should be indicated in the Help file, I guess. But is it really that important that we have this rule? jps (talk) 20:45, 12 August 2024 (UTC)Reply
Actually, scratch that. In the Help:Citation Style 1 § Dates section it says that we should use slashes! Sources are at liberty to use other ways of expressing dates, such as "spring/summer" or a date in a religious calendar; editors should report the date as expressed by the source. Although the seasons are not normally capitalized, they are capitalized when used as dates in CS1 templates, and the capitalization of the season stated by the source may be altered to follow this convention. In cases where the date as expressed in the source is not compatible with the template software, the citation should be created without using a template. So this should be fixed in the code unless it would break something else. Otherwise, seems like I am required to use a non-templated format which would be pretty annoying if that were the case. For a single slash I have to abandon the template? jps (talk) 20:48, 12 August 2024 (UTC)Reply
Near the top of the help text is a bullet list. The sixth item in that list is:
  • hyphens or slashes instead of en dashes in date ranges (en dashes are required)
A bit further down is a table captioned: Examples of unacceptable dates and how to fix them; see the second item. See also the table Help:Citation Style 1 § Date format compliance with Wikipedia's Manual of Style
Trappist the monk (talk) 17:55, 12 August 2024 (UTC)Reply
Slashes are the normal way I have seen bibliographies indicate two seasons. En dashes make sense as a punctuation requirement for specific dates so that, for example, parsers can work, but I see no reason why a Season string should throw an error for including a slash. Is there some sort of code that / breaks in the templates? If not, it is apparently a mere stylistic choice. jps (talk) 20:44, 12 August 2024 (UTC)Reply
Yes, it is a style choice on Wikipedia to use en dashes for day, month, season, and year ranges. The template complies with that style choice. Wikipedia's Manual of Style (MOS) has a lot of guidance for editors. It can be a lot to absorb, so take your time. I have been here for over ten years and still learn things when I visit the MOS pages. – Jonesey95 (talk) 21:29, 12 August 2024 (UTC)Reply
This is fine for day, month, and year ranges, but why seasons? I don't see any discussion that explains how that consensus was arrived at. Can you point me to it? Otherwise, it looks like consensus imposed on sloppy exclusions in the code near edge cases. jps (talk) 21:31, 12 August 2024 (UTC)Reply
These are date rangers, and all date ranges are expressed with dashes. Headbomb {t · c · p · b} 16:44, 6 September 2024 (UTC)Reply
I'll also note that in the style guide you cite, there is text that covers this very situation: The slash notation (2005/2006) may be used to signify a fiscal year or other special period, if that convention is used in reliable sources. Seems like the appropriate thing to do here is use slash since that is what the source uses. jps (talk) 21:33, 12 August 2024 (UTC)Reply

Anonymous authors

edit

Using |author1=Anonymous generates an error message which directs editors to Help:CS1 errors#generic name. That section says to "use a more appropriate parameter", but does not say which, much less give an example.

Which parameter would be appropriate? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 09:11, 28 August 2024 (UTC)Reply

How to find "Script warning: One or more {{cite journal}} templates have maintenance messages;" errors

edit

I'm editing Atomic clock which at the moment has 212 references. Before saving my edits, I preview the article and the above message is displayed. I know such nits are common and may be preexisting and not in anything I added. The question is "which one of the 212 references needs fixing?"

To see it yourself, start at https://en.wikipedia.org/w/index.php?title=Atomic_clock&action=edit&oldid=1241897325 and hit "Show preview".

I suppose best would be an #anchor that was linked to directly. Second, a pattern I could search for. But "warning", "maintenance", "template", "{{cite" and "help" all fail to turn up anything.

Then there's the "messages may be hidden" postamble. Does that mean hidden in the public rendered version (reasonable for minor things), or hidden in the preview I'm looking at this instant? The latter seems stupid and useless. Editing and reloading custom CSS styles is a giant PITA that risks losing my in-progress Wikipedia edits.

After much effort, I asked the browser for an unstyled render and found appended to reference #4 ("First accuracy evaluation of NIST-F2" the text " {{cite journal}}: Empty citation (help): CS1 maint: DOI inactive as of June 2024 (link)". It turned out someone omitted the final digit 4 from the doi:10.1088/0026-1394/51/3/174.

An easy fix, made infuriating by the difficulty of finding the freaking error message. It should not require such an epic struggle.

There really should be a clickable link, or a documented searchable text string (like "CS1 maint:") to enable an editor to easily find the offending citation template. 97.102.205.224 (talk) 09:43, 6 September 2024 (UTC)Reply

I clicked and looked, before I realized you found it, and you know the search string now. The doc pages of templates are open to editing by all, and you are welcome to add appropriate text to the doc page of the type you suggest to aid other editors in finding the problem more quickly than you were able to, and it would be appreciated. Mathglot (talk) 10:34, 6 September 2024 (UTC)Reply
@Mathglot: I can propose an {{edit semi-protected}} for the documentation, but the way I did it depends on my using Firefox; other browsers don't have View > Page Style > No Style menu options in the base browser. You need to enable developer extensions, add a plug-in, or enter some esoteric javascript incantation. (I think viewing the HTML source and searching that would work, but it's pretty cluttered and hard to read.) 97.102.205.224 (talk) 12:33, 6 September 2024 (UTC)Reply
First this is not an error, this is a maintenance message. This is hidden by default because broken DOIs are common and do not usually required any action from the reader or most editors (bots handle this usually). That's why it's flagged as maintenance, and not error.
Second, there is a searchable string, and that searchable string is indeed "CS1: maint". If you followed the help link in the preview message, you'd know this. To enable it, you must be a logged in editor with a custom .css file in your userspace. Headbomb {t · c · p · b} 14:45, 6 September 2024 (UTC)Reply
@Headbomb: Um, you'll find the string is actually "CS1 maint:" (notice the location of the colon). Second, that information does not appear anywhere on the linked help page. Please go and search yourself if you doubt me! You can find mention of Category:CS1 maint: archived copy as title, but that's not described as text that appears in the maintenance message.
Seriously, "If you... you'd know this" comes across as pretty impatient, and it's not justified. Reading the linked help was the first thing I did, and the help page was spectacularly useless; thus my plaint on this, the corresponding talk page.
I fail to see the point of having the visibility of the header not linked the visibility of the messages, but that's a larger-scale issue; in the short term the confusingness can be mitigated with better documentation. Just for example, "hidden by default" would be much clearer than "may be hidden", as it gives the reader some clue about "depending on what?"
I'll try to come up with a proposed edit to fix it, it's just going to be pretty involved so I've been putting it off. 97.102.205.224 (talk) 05:50, 7 September 2024 (UTC)Reply

If you click the help link, you are taken to Help:CS1_errors#Controlling_error_message_display, which I will partly reproduce and bold/embiggen here:

Preview messages

This is only a preview; your changes have not yet been saved! → Go to editing area Script warning: One or more {{cite book}} templates have maintenance messages; messages may be hidden (help).

Error and maintenance messages

By default, Citation Style 1 and Citation Style 2 error messages are visible to all readers and maintenance messages are hidden from all readers.

To display maintenance messages in the rendered article, include the following text in your common CSS page (common.css) or your specific skin's CSS page and (skin.css). (Note to new editors: those CSS pages are specific to you, and control your view of pages, by adding to your user account's CSS code. If you have not yet created such a page, then clicking one of the .css links above will yield a page that starts "Wikipedia does not have a user page with this exact name." Click the "Start the User:username/filename page" link, paste the text below, save the page, follow the instructions at the bottom of the new page on bypassing your browser's cache, and finally, in order to see the previously hidden maintenance messages, refresh the page you were editing earlier.)

.mw-parser-output span.cs1-maint {display: inline;} /* display Citation Style 1 maintenance messages */

After (error and/maintenance) messages are displayed, it might still not be easy to find them in a large article with a lot of citations. Messages can then be found by searching (with Ctrl-F) for "(help)" or "cs1".

Headbomb {t · c · p · b} 11:04, 7 September 2024 (UTC)Reply