Skip to content

[BUG] Electron crashes on Linux with TypeError: Cannot read properties of undefined (reading 'on') #6

@apoapostolov

Description

@apoapostolov

Bug Report

Summary

ClawControl v1.2.0 Electron app crashes on Linux (Pop!_OS) with a runtime error: "TypeError: Cannot read properties of undefined (reading 'on')"

Environment

  • OS: Pop!_OS (likely Cosmic Desktop based on gnome-session* targets visible)
  • Node.js: v18.x (from dist-electron/main.js minified)
  • Electron: Latest version (implied by error)
  • Systemd: User session, configured with user-level service

Steps to Reproduce

  1. Clone repo: git clone https://github.com/jakeledwards/ClawControl.git
  2. Install: npm install
  3. Run: npm run dev

Expected Behavior

Application should start Electron main window normally.

Actual Behavior

Application crashes immediately with error:

TypeError: Cannot read properties of undefined (reading 'on')
    at Module.<anonymous> (/home/apoapostolov/git-ext/ClawControl/dist-electron/main.js:1:2333)
    at Object.<anonymous> (/home/apoapostolov/git-ext/ClawControl/dist-electron/main.js:1:2333)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main_module:154:5)
    at node:internal/main/run_main_module:33:47)

Error Details

The error occurs in Electron's main process when it tries to access properties of an undefined object using the 'on' key. This suggests:

  1. Some object that should exist is undefined
  2. Possibly platform-specific issue with Electron on Linux/Pop!_OS
  3. May be related to how the app initializes the main process

Additional Context

  • The app is built with Electron + React + Vite
  • Uses Capacitor for some platform integrations
  • The error occurs during app startup (before any user interaction)
  • Build completes successfully (npm run build shows no errors)
  • Runtime error only happens when executing the built app

Suggested Fix

Investigate which object is supposed to have the 'on' property being read. This may be:

  • The global app object from Electron
  • A configuration object that's not properly initialized
  • BrowserWindow instance that's being accessed before initialization

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-infoMore information required from reporter

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions