Issue 222 Assets Page Never Loaded - edmozley/freeitsm GitHub Wiki
Reported: #222 by Abdullah31H, October 2026 ยท Module: Assets ยท Present in: 4.3.0 only ยท Fixed in: 4.4.0 (changelog #2654)
After upgrading to 4.3.0, Assets showed its loading spinner and never listed anything. The browser's developer console said:
Uncaught SyntaxError: missing ) after argument list
The data was fine. api/assets/get_assets.php returned every asset โ the page just never asked for them.
๐ The reporter found the exact line and the cause before writing in. Most of this page is theirs; it is written up because the way it broke is worth knowing.
4.3.0 added switching modules off (#217). On the Assets page, the CMDB link section should not appear when CMDB is switched off, so this line:
if (window.CiAssetLink) CiAssetLink.mount(document.getElementById('ciLinkSection'), {was meant to gain one condition and an explanatory comment at the end. What shipped was:
if (window.CiAssetLink && window.ASSET_MODULE_ON.cmdb) CiAssetLink.mount( // GH #217: an empty section while CMDB is offdocument.getElementById('ciLinkSection'), {The comment landed in the middle of the line, straight after mount(, and with no line break after it. A // comment runs to the end of the line, so everything after it โ document.getElementById('ciLinkSection'), { โ became part of the comment. Look closely at "is offdocument": that is the join.
What the browser actually parsed was:
if (...) CiAssetLink.mount(
side: 'asset', id: assetId, ...side: 'asset' is not a valid function argument, hence missing ) after argument list.
The Assets page keeps its JavaScript in one large inline <script> block โ over 2,000 lines. A syntax error is not like a runtime error: the browser cannot run part of a script it cannot parse, so it runs none of it. Not the function that loads the list, not the search box, not the click handlers. The line was inside the asset detail code, which you would not even reach until you clicked an asset โ but it killed the list too, because the list is in the same block.
โ ๏ธ This is the general lesson. A typo in a rarely-used branch of a big inline script does not break the rare branch. It breaks the page.
-
php -lpassed. It is a PHP file, and the PHP was valid. To PHP, the JavaScript is just text to send. - The page returned HTTP 200. The server did its job perfectly.
- The tests passed. The #217 tests check that a switched-off module is hidden โ the server side. None of them loaded the Assets page in a browser.
- The commit was large โ 119 files, because switching a module off has to reach every menu, screen and API that mentions it. The one bad line was a small change in a big diff.
A mistake like this is usually made more than once, so before fixing it the rest of 4.3.0 was swept two ways:
-
Every line the #217 commits added was searched for a
//comment followed by code (getElementById, a trailing{or,, an arrow function). Only this line matched. -
Every screen 4.3.0 changed โ 37 of them, from Tickets and Tasks to Forms, Workflows, Reporting and the portal โ was opened in a real (headless) Chrome while signed in, and its console checked for
Uncaught. All clean apart from Assets.
So Assets was the only casualty.
The comment moves to its own line above:
// GH #217: an empty section while CMDB is off
if (window.CiAssetLink && window.ASSET_MODULE_ON.cmdb) CiAssetLink.mount(document.getElementById('ciLinkSection'), {The behaviour #217 intended is unchanged: the CMDB link section still stays hidden when CMDB is switched off.
| File | Change |
|---|---|
๐ฆ asset-management/index.php
|
the comment moved to its own line |
The real Assets page was loaded in headless Chrome with a signed-in session, and the browser console read back:
| Code | Console | Assets listed |
|---|---|---|
| broken (4.3.0) | Uncaught SyntaxError: missing ) after argument list |
none |
| fixed | clean | all of them (641 on the test install) |
Running the check against the broken code too matters: it proves the check can fail. A check that has never been seen to fail proves nothing. Headless Chrome also has to be run in its older mode (--headless=old --enable-logging=stderr) โ the newer mode prints no console output at all, so it would have said "no errors" about the broken page as well.
-
No automated test guards against this.Since 4.4.0, two do: Page health - System โ Debug Tools โ D019 checks every page in your browser, and a GitHub check parses every page's scripts on every change. Run against 4.3.0's ownasset-management/index.php, the GitHub check fails at line 2652 with this exact error.
-
On 4.3.0: the fix is on
mainnow and ships in 4.4.0. Until then, pullmain, or move the comment yourself as the reporter did (below). Then hard-refresh (Ctrl-F5) on the Assets page. No database change, and none of your asset data was ever affected. - Patched it yourself, as the reporter did? Their fix โ the comment moved to the end of the line โ is equivalent. Upgrading replaces it cleanly.
- On 4.2.0 or earlier: you were never affected.