Skip to content

Dashboard: a folder with a match-all regex (^) crashes the entire folder render (Docker + VM) #47

Description

@chodeus

Summary

A folder configured with a match-everything regex (e.g. ^, and likely .* / .) crashes the entire dashboard folder render. The Docker section throws mid-render, and because createFolders() runs Docker and VM rendering in one async function with no isolation, all VM folders silently disappear and the Docker render is left half-wired (folder clicks do nothing).

Not version-specific: the relevant code is unchanged between v2026.06.25 and v2026.07.08 — it's triggered by the regex config, not the release.

Symptoms

  • One or more folders fail to appear on the Dashboard (VM folders vanish entirely).
  • Clicking Docker folder tiles does nothing (context/expand handlers never attached).
  • Console error: TypeError: Cannot read properties of undefined (reading 'info').

Repro

  1. Create a Docker folder with regex ^ (no explicit containers needed).
  2. Open the Dashboard tab.
  3. Docker folders render partially / clicks are dead, and every VM folder disappears.

Root cause

scripts/dashboard.js

  1. Regex over-matches non-container entries. order holds container names and folder-<id> placeholder entries. ^ matches those placeholders too:

    // dashboard.js:257 (docker)  and  :462 (vm)
    folder.containers = folder.containers.concat(order.filter(el => regex.test(el)));

    A folder's own folder-<id> placeholder survives the later cutomOrder filter (which intentionally keeps folder-${id}), so it enters the render loop as a bogus "container".

  2. Undefined container is dereferenced. In the render loop the placeholder resolves to undefined:

    // dashboard.js:304
    const ct = containersInfo[container];        // undefined for a 'folder-<id>' entry
    // dashboard.js:313
    ...addClass(`${!(ct.info.State.Autostart === false) ? 'autostart' : ''}`)  // ct.info -> throws
  3. No isolation between Docker and VM render. createFolders() (dashboard.js:30) renders Docker (lines 34–138) then VM (143+) in a single async function with no try/catch between them, so the Docker throw rejects the whole function before the VM section runs → all VM folders vanish.

The same regex + render pattern exists on the VM path (createFolderVM, lines 459–463), so it must be fixed in both places.

Proposed fix

  1. Exclude folder- placeholders from the regex match (dashboard.js:257 and :462):
    folder.containers = folder.containers.concat(order.filter(el => !folderRegex.test(el) && regex.test(el)));
  2. Guard the undefined container in the docker render loop (after dashboard.js:304) and the VM equivalent:
    const ct = containersInfo[container];
    if (!ct) continue;
  3. Isolate Docker vs VM rendering in createFolders() — wrap each section in try/catch so a failure in one can't abort the other.
  4. (Optional) Validate/reject degenerate regexes (^, .*, empty-after-trim) in the folder editor (Folder.page) with an inline warning, so a catch-all can't be saved by accident.

Notes

  • Consider whether a "catch-all / new containers" folder is a wanted feature; if so it needs a dedicated, safe implementation rather than a user-supplied ^ regex.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions