Jump to content

Wikipedia:Lua error messages

From Wikipedia, the free encyclopedia

This essay describes error and advisory messages (such as Script error) when running Lua scripts in Wikipedia.

Script error

[edit]

Almost any problem which occurs when running a Lua module will be reported as "Script error" during program execution, such as invalid data or a misspelled variable name in the Lua source code. Although that message typically indicates a logic error inside the Lua script, it can also occur when a Lua function has been stopped due to a timeout limit (see below: Lua timeout error), and no actual bug is inside the Lua script. To determine the exact cause of script errors, it might be necessary to view-source to inspect the generated HTML code for the page.

The error reporting in Lua modules is extremely limited and poor, as if Lua had been designed by copying the work of computer scientists but developed by novices with almost no broad experience in using computer languages. Consequently, it is often necessary to write debugging functions into Lua modules, to show the status of the related variables just before a script error occurs. A common tactic is to show trace statements or "print statements" which can indicate the program flow as it leads up to a specific script error. By that method, the related script section, where a script error has occurred, can be pinpointed more precisely, along with showing the values of related variables at that time. For more, see: wp:Lua debugging.

Modern computer languages typically have a variety of specific error messages which help to pinpoint the error conditions, but not Lua, and those messages require space to store, and so, tiny computers often report short cryptic messages, even though a large number of errors could be pinpointed with specific messages itemizing the related details when an error was detected. Also, there has been a tendency to quietly ignore unknown/misspelled words in languages, in case those words would be added as new features in the future, which would require allowing the words to be accepted as non-error conditions. For those reasons, computers can be much harder to use now than they were years ago, when many computer systems were carefully designed by professionals to store details related to errors, while new features would be carefully designed, implemented and tested in an upgrade to a system, and so error messages could pinpoint what was incompatible with the overall, coherent design. However, the error detection and reporting, of specific error conditions, can often double or triple the complexity of software, and so that is another reason to just report "Script error" when fatal conditions occur, rather than carefully engineer a more-complex system to track and report the specific details.

For example, many misspelled keywords are unlikely to become "new features" and so common misspellings could be detected and reported to a user, but that would require extra effort to handle. The Lua language has allowed misspelled, or uninitialized, variables to be used in a script which can eventually cause "script error" while giving no other indication of the misspelled name or invalid data.

Lua timeout error

[edit]

When a page has hit the Lua timeout limit (such as 10 seconds in February 2013), then the page will contain span-tags with class="scribunto-error" such as:

  • <strong class="error"><span class="scribunto-error" id="mw-scribunto-error-246">Script error<!--The time allocated for running scripts has expired.--></span></strong>

Also, the bottom of the page might contain the message:

  • "The time allocated for running scripts has expired."

Typically, when a page is re-run with fewer Lua-based templates, then the timeout error will stop.

See also

[edit]