Skip to content

Issue 222 Assets Page Never Loaded

Ed Mozley edited this page Oct 28, 2026 · 3 revisions

The Assets page never loaded in 4.3.0

Reported: #222 by Abdullah31H, October 2026 Β· Module: Assets Β· Present in: 4.3.0 only Β· Fixed in: 4.4.0 (changelog #2654)


What you saw

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.


What was actually wrong

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.

Why one bad line stopped the whole page

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.

Why nothing caught it

  • php -l passed. 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.

It was one place, not several

A mistake like this is usually made more than once, so before fixing it the rest of 4.3.0 was swept two ways:

  1. 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.
  2. 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 fix

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.

πŸ“ Files changed

File Change
🟦 asset-management/index.php the comment moved to its own line

How it was proved

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.

Not proven

  • 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 own asset-management/index.php, the GitHub check fails at line 2652 with this exact error.

What this means for you

  • On 4.3.0: the fix is on main now and ships in 4.4.0. Until then, pull main, 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.

Related

FreeITSM

Getting Started

Modules

Multi-tenancy (planned)

Blue sky thinking

Bugs resolved

Links

Clone this wiki locally