Page MenuHomePhabricator

: Failed to execute Mathoid cli '/srv/mathoid/cli.js' with Math (MW 1.37)
Closed, InvalidPublic

Description

Steps to reproduce:

  1. Inserted a <math> tag (example: <math>\sqrt{2}</math>
  2. Got an internal error

Version:
MediaWiki: 1.37.0 (1612a85)
PHP: 7.4.25 (fpm-fcgi)
MariaDB: 10.4.21-MariaDB-1:10.4.21+maria~buster-log

Backtrace/full error:
MediaWiki internal error.

Original exception: [efda97caa8e03c8098ba508c] /w/index.php?title=Test&action=submit MWException: Failed to execute Mathoid cli '/srv/mathoid/cli.js', reason: internal/fs/utils.js:581
throw new ERR_INVALID_ARG_TYPE(propName, ['string', 'Buffer', 'URL'], path);
^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
at Object.openSync (fs.js:454:10)
at Object.readFileSync (fs.js:364:35)
at getConfig (/srv/mathoid/lib/render.js:75:31)
at Object.startMathJax [as start] (/srv/mathoid/lib/render.js:93:15)
at Object.<anonymous> (/srv/mathoid/cli.js:32:21)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
code: 'ERR_INVALID_ARG_TYPE'
}

Backtrace:
from /srv/mediawiki/w/extensions/Math/src/MathMathMLCli.php(139)
#0 /srv/mediawiki/w/extensions/Math/src/MathMathMLCli.php(35): MediaWiki\Extension\Math\MathMathMLCli::evaluateWithCli(array, integer)
#1 /srv/mediawiki/w/extensions/Math/src/HookHandlers/ParserHooksHandler.php(162): MediaWiki\Extension\Math\MathMathMLCli::batchEvaluate(array)
#2 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(160): MediaWiki\Extension\Math\HookHandlers\ParserHooksHandler->onParserAfterTidy(Parser, string)
#3 /srv/mediawiki/w/includes/HookContainer/HookRunner.php(2845): MediaWiki\HookContainer\HookContainer->run(string, array)
#4 /srv/mediawiki/w/includes/parser/Parser.php(1726): MediaWiki\HookContainer\HookRunner->onParserAfterTidy(Parser, string)
#5 /srv/mediawiki/w/includes/parser/Parser.php(659): Parser->internalParseHalfParsed(string, boolean, boolean)
#6 /srv/mediawiki/w/includes/content/WikitextContent.php(327): Parser->parse(string, Title, ParserOptions, boolean, boolean, NULL)
#7 /srv/mediawiki/w/includes/content/AbstractContent.php(548): WikitextContent->fillParserOutput(Title, NULL, ParserOptions, boolean, ParserOutput)
#8 /srv/mediawiki/w/extensions/SpamBlacklist/includes/SpamBlacklistHooks.php(50): AbstractContent->getParserOutput(Title, NULL, ParserOptions, boolean)
#9 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(160): SpamBlacklistHooks->onEditFilterMergedContent(DerivativeContext, WikitextContent, Status, string, User, boolean)
#10 /srv/mediawiki/w/includes/HookContainer/HookRunner.php(1485): MediaWiki\HookContainer\HookContainer->run(string, array)
#11 /srv/mediawiki/w/includes/editpage/Constraint/EditFilterMergedContentHookConstraint.php(90): MediaWiki\HookContainer\HookRunner->onEditFilterMergedContent(DerivativeContext, WikitextContent, Status, string, User, boolean)
#12 /srv/mediawiki/w/includes/editpage/Constraint/EditConstraintRunner.php(88): MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint->checkConstraint()
#13 /srv/mediawiki/w/includes/EditPage.php(2264): MediaWiki\EditPage\Constraint\EditConstraintRunner->checkConstraints()
#14 /srv/mediawiki/w/includes/EditPage.php(1685): EditPage->internalAttemptSave(NULL, boolean)
#15 /srv/mediawiki/w/includes/EditPage.php(665): EditPage->attemptSave(NULL)
#16 /srv/mediawiki/w/includes/actions/EditAction.php(71): EditPage->edit()
#17 /srv/mediawiki/w/includes/actions/SubmitAction.php(38): EditAction->show()
#18 /srv/mediawiki/w/includes/MediaWiki.php(538): SubmitAction->show()
#19 /srv/mediawiki/w/includes/MediaWiki.php(320): MediaWiki->performAction(Article, Title)
#20 /srv/mediawiki/w/includes/MediaWiki.php(925): MediaWiki->performRequest()
#21 /srv/mediawiki/w/includes/MediaWiki.php(559): MediaWiki->main()
#22 /srv/mediawiki/w/index.php(53): MediaWiki->run()
#23 /srv/mediawiki/w/index.php(46): wfIndexMain()
#24 {main}

Exception caught inside exception handler: [efda97caa8e03c8098ba508c] /w/index.php?title=Test&action=submit MWException: Failed to execute Mathoid cli '/srv/mathoid/cli.js', reason: internal/fs/utils.js:581
throw new ERR_INVALID_ARG_TYPE(propName, ['string', 'Buffer', 'URL'], path);
^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
at Object.openSync (fs.js:454:10)
at Object.readFileSync (fs.js:364:35)
at getConfig (/srv/mathoid/lib/render.js:75:31)
at Object.startMathJax [as start] (/srv/mathoid/lib/render.js:93:15)
at Object.<anonymous> (/srv/mathoid/cli.js:32:21)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
code: 'ERR_INVALID_ARG_TYPE'
}

Backtrace:
from /srv/mediawiki/w/extensions/Math/src/MathMathMLCli.php(139)
#0 /srv/mediawiki/w/extensions/Math/src/MathMathMLCli.php(35): MediaWiki\Extension\Math\MathMathMLCli::evaluateWithCli(array, integer)
#1 /srv/mediawiki/w/extensions/Math/src/HookHandlers/ParserHooksHandler.php(162): MediaWiki\Extension\Math\MathMathMLCli::batchEvaluate(array)
#2 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(160): MediaWiki\Extension\Math\HookHandlers\ParserHooksHandler->onParserAfterTidy(Parser, string)
#3 /srv/mediawiki/w/includes/HookContainer/HookRunner.php(2845): MediaWiki\HookContainer\HookContainer->run(string, array)
#4 /srv/mediawiki/w/includes/parser/Parser.php(1726): MediaWiki\HookContainer\HookRunner->onParserAfterTidy(Parser, string)
#5 /srv/mediawiki/w/includes/parser/Parser.php(659): Parser->internalParseHalfParsed(string, boolean, boolean)
#6 /srv/mediawiki/w/includes/cache/MessageCache.php(1326): Parser->parse(string, Title, ParserOptions, boolean)
#7 /srv/mediawiki/w/includes/language/Message.php(1333): MessageCache->parse(string, Title, boolean, boolean, LanguageEn)
#8 /srv/mediawiki/w/includes/language/Message.php(930): Message->parseText(string)
#9 /srv/mediawiki/w/includes/language/Message.php(982): Message->format(string)
#10 /srv/mediawiki/w/extensions/JSBreadCrumbs/includes/JSBreadCrumbsHooks.php(44): Message->parse()
#11 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(338): JSBreadCrumbsHooks::onBeforePageDisplay(OutputPage, SkinVector)
#12 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#13 /srv/mediawiki/w/includes/HookContainer/HookRunner.php(947): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#14 /srv/mediawiki/w/includes/OutputPage.php(2639): MediaWiki\HookContainer\HookRunner->onBeforePageDisplay(OutputPage, SkinVector)
#15 /srv/mediawiki/w/includes/exception/MWException.php(193): OutputPage->output()
#16 /srv/mediawiki/w/includes/exception/MWException.php(231): MWException->reportHTML()
#17 /srv/mediawiki/w/includes/exception/MWExceptionHandler.php(105): MWException->report()
#18 /srv/mediawiki/w/includes/exception/MWExceptionHandler.php(202): MWExceptionHandler::report(MWException)
#19 /srv/mediawiki/w/includes/MediaWiki.php(578): MWExceptionHandler::handleException(MWException, string)
#20 /srv/mediawiki/w/index.php(53): MediaWiki->run()
#21 /srv/mediawiki/w/index.php(46): wfIndexMain()
#22 {main}

Event Timeline

Change 742846 had a related patch set uploaded (by Universal Omega; author: Universal Omega):

[mediawiki/services/mathoid@master] [Mathoid] Fix support for commander v7 usage of storeOptionsAsProperties

https://gerrit.wikimedia.org/r/742846

Universal_Omega changed the task status from Open to In Progress.Dec 1 2021, 1:12 AM
Universal_Omega changed the task status from In Progress to Open.
Universal_Omega claimed this task.

Upgrading mathoid actually fixes this. I mentioned more information on the patch, so leaving that open but no further action needed on this task except upgrading mathoid.

Change 742846 merged by jenkins-bot:

[mediawiki/services/mathoid@master] [Mathoid] Fix commander program.config is undefined

https://gerrit.wikimedia.org/r/742846