Extension talk:Scribunto

Jump to navigation Jump to search

About this board

  • This page uses "Flow".
  • It has most recently started discussions at the top.
  • The page loads dynamically, meaning you can't tell how much more you will see when you scroll down (talkcontribs)


I'm managing a wiki that had the Scribunto extension installed for some time but really wasn't used much except on a couple of test pages. I'm upgrading the wiki now (from 1.28 to 1.31) and have removed the Scribunto extension. However, when I run the scripts to populate the CirrusSearch index, I get the following traceback:


[7c132a3761cb626266d8cab6] [no req]   MWUnknownContentModelException from line 306 of /var/www/html/mediawiki-1.31.0/includes/content/ContentHandler.php: The content model 'Scribunto' is not registered on this wiki.

See https://www.mediawiki.org/wiki/Content_handlers to find out which extensions handle this content model.


#0 /var/www/html/mediawiki-1.31.0/includes/content/ContentHandler.php(243): ContentHandler::getForModelID(string)

#1 /var/www/html/mediawiki-1.31.0/includes/Title.php(4984): ContentHandler::getForTitle(Title)

#2 /var/www/html/mediawiki-1.31.0/includes/parser/Parser.php(892): Title->getPageLanguage()

#3 /var/www/html/mediawiki-1.31.0/includes/parser/Parser.php(2126): Parser->getTargetLanguage()

#4 /var/www/html/mediawiki-1.31.0/includes/parser/Parser.php(2091): Parser->replaceInternalLinks2(string)

#5 /var/www/html/mediawiki-1.31.0/includes/parser/Parser.php(1318): Parser->replaceInternalLinks(string)

#6 /var/www/html/mediawiki-1.31.0/includes/parser/Parser.php(443): Parser->internalParse(string)

#7 /var/www/html/mediawiki-1.31.0/includes/content/WikitextContent.php(323): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)

#8 /var/www/html/mediawiki-1.31.0/includes/content/AbstractContent.php(516): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)

#9 /var/www/html/mediawiki-1.31.0/includes/content/ContentHandler.php(1324): AbstractContent->getParserOutput(Title, integer, ParserOptions)

#10 /var/www/html/mediawiki-1.31.0/extensions/CirrusSearch/includes/Updater.php(363): ContentHandler->getParserOutputForIndexing(WikiPage, ParserCache)

#11 /var/www/html/mediawiki-1.31.0/extensions/CirrusSearch/includes/Updater.php(204): CirrusSearch\Updater->buildDocumentsForPages(array, integer)

#12 /var/www/html/mediawiki-1.31.0/extensions/CirrusSearch/maintenance/forceSearchIndex.php(218): CirrusSearch\Updater->updatePages(array, integer)

#13 /var/www/html/mediawiki-1.31.0/maintenance/doMaintenance.php(94): CirrusSearch\ForceSearchIndex->execute()

#14 /var/www/html/mediawiki-1.31.0/extensions/CirrusSearch/maintenance/forceSearchIndex.php(679): require_once(string)

#15 {main}


I found a few phabricator tickets that appear to be related but haven't yet found a workaround beyond reinstalling the Scribunto extension. Is there one? Is there a way to remove the Scribunto content model and/or references to it? (talkcontribs)

Additionally, I thought if I did an XML dump of all pages and revisions I would find a page using "<model>Scribunto</model>" but I don't seem to have any pages with that.

2620:11E:1000:120:1792:B56B:4655:6029 (talkcontribs)

Okay, I think I got it fixed. It turns out that if pages exist in the database in a namespace that mediawiki doesn't know about, there is no way to display them and they don't show up in an XML export either. I was able to reset the page content model of the single interfering page in the database like so:

UPDATE page SET page_content_model = 'wikitext' WHERE page_content_model = 'Scribunto'; (talkcontribs)

You are my hero; just had the exact same problem. Thank you _very_ much for posting the problem and the solution. I've never installed or run Scribunto, so never occurred to me to check for it.

#GrayanOne (talkcontribs)

Thanks for this!! I also had to run UPDATE content SET content_model = 1 WHERE content_model = 11 and delete the Scribunto row from the content_model table before the error would go away.

Tenbergen (talkcontribs)

Two small things...

  • I think I use a default install of mediawiki, and the table names are prefixed with "mw_", so I had to modify the two queries accordingly.
  • * for me the content_model was "3", not "11", so I suspect that is variable depending on what else is installed on your wiki.

Here is what I had to do:

  • Run the following to get the content mode ID:
    • SELECT * FROM mw_content_models WHERE model_name = 'Scribunto';
    • note the model_id and use it in the next SQL queries
  • Delete the Scribunto line from content model
    • DELETE FROM mw_content_models WHERE model_name = 'Scribunto';
  • Replace all lines in content where content model was ID of Scribunto with ID of wikitext
    • UPDATE mw_content SET content_model = 1 WHERE content_model = <the id you retrieved in the first query>
  • Replace all lines with Scribunto in the page table with wikitext
    • UPDATE mw_page SET page_content_model = 'wikitext' WHERE page_content_model = 'Scribunto';

I have added this to a section "Uninstalling Scribunto" on the extension page, so if you find corrections, please update there as well.

Reply to "Uninstalling Scribunto"

How to solve the Internal link helper error?

Readmanhe (talkcontribs)

Hello guys, I find out that, my Scribunto throws a error

黄绍铭Lua错误 ...ribunto/includes/engines/LuaCommon/lualib/mwInit.lua的第23行:bad argument #1 to 'old_ipairs' (table expected, got nil)Billy Ng

when it works on source code with double brackets

Reply to "How to solve the Internal link helper error?"

How to disable Scribunto error logging

Latisc (talkcontribs)

Is there any way to keep Scribunto from logging errors into /dev/null? I don’t want to keep an enormous log file on my server. I tried putting $wgScribuntoEngineConf['luastandalone']['errorFile'] = null; in LocalSettings.php, but that didn’t solve the problem.

Rayanth (talkcontribs)

Unless you have an extremely bizarre setup, /dev/null by definition takes up no space - anything routed to /dev/null is deleted by the OS. Think of it as an empty void things get sent to, to remove them from existence.

Latisc (talkcontribs)

Is there still any way I can turn off error logging?

Anomie (talkcontribs)

The way to turn it off is to write it to /dev/null.

Reply to "How to disable Scribunto error logging"

chcon: can't apply partial context to unlabeled file ‘lua’

AndyPKU (talkcontribs)

When I follow the manual instruction, and did "chcon -t httpd_sys_script_exec_t /path/to/extensions/Scribunto/engines/LuaStandalone/binaries/yourOS/lua" this, it sais that can't aplly partial context to unlabeled file 'lua'. What should I do?

Dinoguy1000 (talkcontribs)

Did you change the system path as appropriate for your environment? The path shown on the page is only a sample and won't work verbatim unless you intentionally set up your server with that directory structure. Specifically, the /path/to/extensions refers to the /extensions directory in MediaWiki's base directory; on a default server this might therefore be /var/www/html/extensions. Additionally, the /yourOS directory is just an example and needs to be replaced as appropriate; check what directories are contained in /extensions/Scribunto/engines/LuaStandalone/binaries and select the correct one for the operating system your server is running.

AndyPKU (talkcontribs)

in fact, my lua is in the path /var/www/html/extension/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic,and I use the command CD into this directory and use command as chcon -t httpd_sys_script_exec_t lua, I am not sure whether it is suitable, but I take it for grunted.. (talkcontribs)

Same issue here.

Trying with chcon -t httpd_sys_script_exec_t /var/www/mediawiki/extensions/Scributon/engines/LuaStandalone/binaries/lua5_1_5_linux_32_generic/lua sends the same error my way.

I am trying to setup my wiki using a Raspberry Pi 3, using 32-bit Raspbian. (talkcontribs)

Have anybody resolved this problem? What was the reason? (talkcontribs)

same problem here, tried running using just lua (from inside the 1_5_* folder) as well as using proper paths

Reply to "chcon: can't apply partial context to unlabeled file ‘lua’"
Alex Mashin (talkcontribs)

Can any of the two new hooks provided by Scribunto be used to enable requiring .so Lua modules?

Reply to ".so lua modules"
Probus (talkcontribs)

Hi everyone,

I've been trying to solve this using error fixing advice I found elsewhere on this site, but it hasn't worked. I'm desperate at this point and really need help. I'm afraid I also know very little about all this, so please be patient with me.

What I'm trying to do is import Infoboxes from Wikipedia onto my own wiki. I followed the instructions under [1] and believe I've imported everything I need, but when I load e.g. [2], I get the following red error message:

"Lua error: Internal error: The interpreter exited with status 126."

This is new actually. It had previously been "status 11" (I think), but after following the instructions I found at [3], the message changed to "status 126".

Please, please help me!! And thank you in advance! :)

[1] Manual:Importing Wikipedia infoboxes tutorial

[2] Trying to avoid the spam filter here. My wiki is at "lacerta.palfreyman.de/wiki". There, search for "Template:Infobox".

[3] (Solved) Lua scribunto error on many pages (status 127)

Mr. Stradivarius (talkcontribs)

Status 126 means that your Lua binary is not executable, according to bug T48135. To fix it, you need to change the permissions for the Lua binary. Probably running a command like this will work:

chmod +x path/to/lua

That bug report says that the message "The interpreter exited with status 126" was replaced with a more helpful error message, but on checking the code, it seems that the helpful error message is not output if you set the path to the Lua binary explicitly using the "luaPath" option.

Reply to "Lua Scribunto error (status 126)"
SANtosito (talkcontribs)

I'm trying to make syntax highlighting working in modules but apparently sth is missing. I have installed WikiEditor, SyntaxHighlight, CodeEditor and have done everything as said in manual. All installed extension are working , just seems it dosen't work with Scribunto, so I guess the problem must be sth else

wfLoadExtension( 'WikiEditor' );

wfLoadExtension( 'SyntaxHighlight_GeSHi' );

wfLoadExtension( 'CodeEditor' );

wfLoadExtension( 'Scribunto' );

$wgScribuntoDefaultEngine = 'luastandalone';

$wgScribuntoEngineConf['luastandalone']['key'] = 'value';

$wgScribuntoUseGeSHi = true;

$wgScribuntoUseCodeEditor = true;


WikimeSteve (talkcontribs)

I do not see a solution and outcome here. I am having the same issue. We do not have CodeEditor installed though. Is that required?

Syntax highlighting is working on all other pages as expected. With the following should we see module syntax highlighting or do we need anything else?

$wgScribuntoDefaultEngine = 'luastandalone';

$wgScribuntoEngineConf['luastandalone']['key'] = 'value';

$wgScribuntoUseGeSHi = true;

wfLoadExtension( 'WikiEditor' );

wfLoadExtension( 'SyntaxHighlight_GeSHi' );

wfLoadExtension( 'Scribunto' );

Update: I just copied the Lua code from a Module window. Pasted it into a blank page and surrounded it with <syntaxhighlight lang="Lua">. When I click show demo it was all nice and colorful and matches how it looks on the same module on Wikipedia. So our SyntaxHighlight seems fine. The Module view just does not show it on our Wiki.

Reply to "Syntax highlighting not working"

Some visual problems with the Module pages

WikimeSteve (talkcontribs)

I have functional Template pages showing the Green box for Documentation pages and showing the <nowiki>[view] [edit] [history] [purge]</nowiki>. Our Module pages have Documentation pages but they show up without the styling (plain white background) and I have to enter /doc in the URL to view and edit them since I do not see the 4 item menu.

I am not seeing the syntaxhighlighting but just found that there is a setting to turn that on so I think that will be fine.

We do not have CodeEditor Extension installed so that will remain false unless it is required.

Is there another setting in the Scibunto configuration that we are missing so it uses the common.css like templates is?

I have tried to import all Documentation Templates and Modules.

Dinoguy1000 (talkcontribs)
WikimeSteve (talkcontribs)

Works fine now. Thank you very much.

Reply to "Some visual problems with the Module pages"

Empty TemplateData and Lua script error

Hwgen22 (talkcontribs)

Recently, I have installed a MediaWiki instance locally on a virtual machine that I own. I have also installed VisualEditor, which is working fine.

As I and the future users of this wiki will need to insert references to document the web pages being written, I wanted to install the citation tool (https://www.mediawiki.org/wiki/VisualEditor/Citation_tool) to have something similar to what is being used on Wikipedia.

I have followed the steps carefully:

- I have installed Scribunto, ParserFunctions, Cite and TemplateData;

- I have imported some templates (e.g. Template:Cite_web) from Wikipedia, by using, respectively, the export and the import tools;

- I have specified the configuration message needed for the tool (MediaWiki:Visualeditor-cite-tool-definition.json).

When I use the VisualEditor tool, I see the "Cite" button and the different templates are listed. However, when I select any of the listed templates, no data appears (the template is empty).

In accordance with the troubleshooting part (https://www.mediawiki.org/wiki/VisualEditor/Citation_tool#Troubleshooting), I have tried to make a null edit the content of both the documentation page (e.g. Template:Cite_web) and the source page (e.g. Template:Cite_web/doc) by clicking on Edit then saving directly. This didn't help.

Also, I have tried to follow the different indications on this topic which deals with the same issue, but nothing worked so far.

This problem seems to be related to this bug (https://phabricator.wikimedia.org/T52372), however, the null edit does not resolve the issue.

The following API call is done when I try to open e.g. the web template from the Cite button:

"api.php?action=templatedata&format=json&titles=Template%3ACite web&lang=en&formatversion=2&doNotIgnoreMissingTitles=1&redirects=1"

Which results to this response:


  "batchcomplete": true,

  "warnings": {

  "main": {

     "warnings": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."


  "templatedata": {

     "warnings": "The parameter \"doNotIgnoreMissingTitles\" has been deprecated."



  "pages": {

  "23": {

     "title": "Template:Cite web",

     "notemplatedata": true,

     "params": []




Notice that when I click on "Cite" button, I select a template (e.g. Web) and I click on "Insert" even if the template is empty, a reference number is added in the text, but I have an error linked with Lua that is displayed.

Indeed, the file Module:Citation/CS1/styles.css has the following problem:

"Script error: Lua error at line 1: unexpected symbol near '/'."

The file, which comes from Wikipedia (https://en.wikipedia.org/wiki/Module:Citation/CS1/styles.css), has not been modified. By the way, if I remove all the comments, a similar error appears with the code.

Does anyone has any clue on this issue? I really need citation tool to work before adding any content on the wiki, otherwise it will be such a pain to manually add all the references or to update the pages a posteriori.


Operating system: Ubuntu 18.04.1 LTS

Server: Apache2

MediaWiki: 1.31.1 (590e94d)

PHP: 7.2.10

Lua: 5.1.5


VisualEditor: 0.1.0 (13a585a) - 5/30/2018

WikiEditor: 0.5.1 (277159c) - 5/5/2018

Cite: - (20e26df) - 4/17/2018

ParserFunctions: 1.6.0 (f2c63e5) - 10/15/2018

Scribunto: both the latest version for REL1_31 and (cdf41bb) - 11/22/2018

TemplateData: 0.1.2 (0cffe4a) - 10/15/2018

Bootstrap: 1.2.3

Anomie (talkcontribs)
Hwgen22 (talkcontribs)

Hi @Anomie,

Thank you for your response. I tried what you propose, but when I try to change the model of the page to "Sanitized CSS", MediaWiki aborts, giving me the following errors:

Invalid or unsupported value for property background at line 38 character 14.

Invalid or unsupported value for property background at line 44 character 14.

Invalid or unsupported value for property background at line 49 character 14.

The content of the file is exactly the same as the one hosted on Wikipedia (https://en.wikipedia.org/wiki/Module:Citation/CS1/styles.css).

And I still have this "Script error: Lua error at line1: unexpected symbol near '/'." on the page...

Do you know what I'm doing wrong?

Anomie (talkcontribs)

On Wikimedia sites the configuration is adjusted to (rather pointlessly, IMO) allow protocol-relative URLs to Commons images. You can either add "https:" to the URLs on those lines in your copy, or copy the changed configuration to your LocalSettings.php.

You're likely still getting the error because those invalid values prevented the content model change.

Tofiq Kərimli (talkcontribs)

Thank you for your response. I tried what you propose, but when I try to change the model of the page to "Sanitized CSS", MediaWiki aborts, giving me the following errors: [XQqhYFBk9YTsZsEWS2NcswAAAAY] /index.php?title=X%C3%BCsusi:ChangeContentModel Error from line 78 of /home/ipekchi/public_html/wiki/extensions/TemplateStyles/includes/TemplateStylesContent.php: Class 'Wikimedia\CSS\Parser\Parser' not found . What then should I do, did not understand? Because I do not know where this is located: On Wikimedia sites the configuration is adjusted to (rather pointlessly, IMO)... If possible, explain it. Thanks in advance.

Hwgen22 (talkcontribs)

Thank you very much for your quick and useful response, @Anomie!

Now, I can effectively change the model of the page.

However, templates are still missing from the menu on VisualEditor.

When I insert a citation even if the template is missing, a new reference number is added but when I click on it, I have:

"Empty citation (help)<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>".

I don't understand, as the CSS file has now the mode "Sanitized CSS".

The only thing that, visually, is different from Module:Citation/CS1 is that on my imported page, I see things like:

"<section begin=header />", "<section end=header />", etc.

But I don't think that this is the problem causing all this mess.

I really don't know what to do now...

Anomie (talkcontribs)

It sounds like your remaining problems are with VisualEditor rather than Scribunto. You may want to ask on a talk page for that extension.

Hwgen22 (talkcontribs)

Ok I will ask for more help on the VisualEditor page. Thank you again for your help!

Hwgen22 (talkcontribs)

For those who will experience the same issue as me, it seems that waiting for jobs to complete is not sufficient, as if the tasks were frozen (or it takes a very long time). Each time I tried and waited, nothing happened.

Manually executing the job tasks will resolve the problems. To do so, run "php <path_to_wiki_installation>/maintenance/runJobs.php".

Note that for each template, you will still need to make a null edit on each template (e.g. Template:Cite_web).

Jamiehutber (talkcontribs)

Thanks guys. I'm having the exact same problem. I have changed the file type to "Sanitized CSS" however I am still seeing the same error interestingly on the pages using this Module:

Blanche was born into a working-class family in post-war England, and grew up on a Council estate during the 1950s,<ref name=Interview1>Page Module:Citation/CS1/styles.css must have content model "Sanitized CSS" for TemplateStyles (current model is "Scribunto").</ref> a period he describes as 'grey and flat',<ref name=Ratspike>Page Module:Citation/CS1/styles.css must have content model "Sanitized CSS" for TemplateStyles (current model is "Scribunto").</ref> and lacking in the visual richness available to modern youth. Instead he took early inspiration from cinema, his collections of toy soldiers, and producing drawings of historic warriors on the backs of old rolls of wallpaper.<ref name=Ratspike/>

During the 1960s Blanche was exposed to art and art movements, eventually attending art college, where he entered a course on the strength of his drawings and paintings of battle scenes and prehistoric conflicts,<ref name=Ratspike/> and where he recounts that he was told he "had a romantic spirit, but it would never earn me a living, so there was no point in doing it".<ref name=Interview1/>


Jamiehutber (talkcontribs)

Ah ok, you just need to resave the page :D

Reply to "Empty TemplateData and Lua script error"

LuaSandboxFunction::call(): Unable to create timer: Invalid argument in Scribunto/includes/engines/LuaSandbox/Engine.php on line 318

2 (talkcontribs)

Getting a bunch of this warning at the top of any page with lua on it. Doesn't seem to actually affect lua from working, but it's not really usable with all the errors on the page, which I need to leave enabled for development. Couldn't find any results for this error. Running on debian 9 within WSL, which might be the cause?

Anomie (talkcontribs)

Probably WSL has an incomplete implementation of timer_create. LuaSandbox passes the clock ID fetched from pthread_getcpuclockid(pthread_self(), ...).

Reply to "LuaSandboxFunction::call(): Unable to create timer: Invalid argument in Scribunto/includes/engines/LuaSandbox/Engine.php on line 318"