Skip to content

[Bug] 2.37 dev branch,. fails on electronSwitches #4159

@sdetweil

Description

@sdetweil

Environment

System Information

  • SYSTEM: manufacturer: System manufacturer; model: System Product Name; virtual: false; MM: v2.37.0-develop
  • OS: platform: linux; distro: Ubuntu; release: 22.04.5 LTS; arch: x64; kernel: 5.15.0-177-generic
  • VERSIONS: electron: 42.1.0; used node: 24.15.0; installed node: 22.22.1; npm: 10.9.4; pm2: 5.4.3
  • ENV: XDG_SESSION_TYPE: x11; MM_CONFIG_FILE: undefined
    WAYLAND_DISPLAY: undefined; DISPLAY: :0.0; ELECTRON_ENABLE_GPU: undefined
  • RAM: total: 48076.70 MB; free: 40129.30 MB; used: 7947.40 MB
  • OTHERS: uptime: 11076 minutes; timeZone: America/Chicago
    [2026-05-18 14:18:58.875] [LOG] [electron] Launching applic

Which start option are you using?

node --run start:x11

Are you using PM2?

No

Module

None

Have you tried disabling other modules?

  • Yes
  • No

Have you searched if someone else has already reported the issue on the forum or in the issues?

  • Yes

What did you do?

Configuration
    electronSwitches: {
      "password-store": "basic",
      "js-flags": "--max-old-space-size=8192"
    },
<!-- Paste relevant code here -->

Steps to reproduce the issue:

What did you expect to happen?

has been working for 'years' (or maybe not working)

What actually happened?

I added the console.log elsw...

[2026-05-18 14:18:58.876] [LOG]   [electron] elsw { 'password-store': 'basic', 'js-flags': '--max-old-space-size=8192' }
[2026-05-18 14:18:58.877] [ERROR] [unknown] (node:725432) UnhandledPromiseRejectionWarning: TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))
    at createWindow (/home/sam/MagicMirror.2.36.dev/js/electron.js:49:39)

config.js

    electronSwitches: {
      "password-store": "basic",
      "js-flags": "--max-old-space-size=8192"
    },

from the electron doc , SOME switches are keyword/value

app.commandLine.appendSwitch('remote-debugging-port', '8315')
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1')

so the config value cannot be flat array of single values.. ,, I think appendswitch of {'remote-debugging-port': '8315'} , would fail too

i'm guessing the old code didn't work either

        let electronSwitchesDefaults = ["autoplay-policy", "no-user-gesture-required"];
        app.commandLine.appendSwitch(...new Set(electronSwitchesDefaults, config.electronSwitches));

at least, the defaults were connected , "autoplay-policy":"no-user-gesture-required"

changing my switches to

    electronSwitches: [
      {"password-store": "basic"},
      {"js-flags": "--max-old-space-size=8192"}
    ],

doesn't produce an error on startup, but I don't know if the switches are correctly passed..

Additional comments

No response

Participation

  • I am willing to submit a pull request for this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions