omi icon indicating copy to clipboard operation
omi copied to clipboard

Bug: Omi Desktop for Windows crashes on launch after restart attempt with "Cannot find module 'ms'" error

Open hugoaap-code opened this issue 4 months ago • 5 comments

Summary

After closing Omi to check whether recording would resume, the Windows desktop app showed a startup error instead of reopening normally.

This happened after the earlier blank-screen capture problem reported in #10737.

Related issue

  • Related: #10737

Problem

On launch, Omi shows a JavaScript main-process error and fails with:

Error: Cannot find module 'ms'

This appears during app startup, preventing normal use.

Expected behavior

  • Omi should restart normally after being closed
  • Restarting the app should be a valid recovery step after capture issues
  • The app should not fail on launch because of a missing module dependency

Actual behavior

  • Omi was closed to test whether recording would resume after the blank-screen issue
  • On relaunch, the app showed a JavaScript error in the main process
  • The visible error says Cannot find module 'ms'
  • The stack trace points into the packaged Windows app resources

Redacted stack trace detail

The screenshot shows local Windows installation paths. Redacting the personal username, the relevant path pattern is:

C:\Users\<redacted>\AppData\Local\Programs\omi-windows\resources\app.asar\...

Impact

This turns a recording failure into a full app startup failure.

A user who tries to recover from broken capture by restarting the app can end up unable to reopen Omi at all.

Suggested investigation

  • Check why the packaged Windows app is missing the ms module at runtime
  • Verify whether a partial update, corrupted install, or packaging issue can cause this dependency failure
  • Check whether this can be triggered after restarting from a bad capture state
  • Add a safer recovery path or clearer remediation message if a required module is missing
  • Investigate whether the blank-screen capture issue and this startup crash share the same root cause

Environment

  • Omi Desktop
  • Windows
  • Observed on Monday, July 27, 2026

hugoaap-code avatar Jul 27 '26 21:07 hugoaap-code

I reproduced the startup failure from the packaged Windows artifact: electron-builder pruned ms from the Sentry/debug runtime chain, so app.asar/out/main/index.js failed before startup. #10823 fixes that by declaring ms as a direct runtime dependency and adds a final-artifact probe to both unsigned and signed release paths; the rebuilt ASAR and isolated-profile Windows launch passed, and current CI is green. The fix is still awaiting human release-path review and has not merged yet.

tianmind-studio avatar Jul 29 '26 10:07 tianmind-studio

Additional context for this existing issue:

This same Cannot find module 'ms' startup crash also happens after using the in-app updater flow on Windows:

Settings > About > Restart to install latest update

Observed behavior:

  • Click Restart to install latest update
  • Omi closes and appears to update/install a new version
  • When opening Omi after the update, Windows shows:
    • A JavaScript error occurred in the main process
    • Error: Cannot find module 'ms'

So this issue is not limited to restarting after a capture problem. It can also be triggered immediately after the built-in Windows update flow, which suggests the updater may be installing or handing off to a broken packaged build.

hugoaap-code avatar Jul 29 '26 12:07 hugoaap-code

Root cause isolated to the electron-builder version used for the v1.0.33 build, not to a missing dependency declaration — and the packaging bug is already gone on main.

Evidence (all on the same source tree / same pnpm install --frozen-lockfile, packing win32 x64 with the repo config):

  1. Shipped artifact is broken. Unpacked Omi-for-Windows-Setup-1.0.33.exe (latest Windows release): resources/app.asar.unpacked/node_modules/debug/src/common.js is present and does createDebug.humanize = require('ms'), but ms does not exist anywhere in the package (neither in app.asar nor app.asar.unpacked). That is exactly the reported Cannot find module 'ms'.
  2. v1.0.33 was built with electron-builder 26.8.1 (pnpm-lock.yaml at the release commit dfae049).
  3. Repacking today's main with electron-builder 26.8.1 reproduces it: app.asar.unpacked/node_modules/ms → ABSENT, debug → present.
  4. Repacking the identical tree with 26.15.3 (what main pins today) ships it: app.asar.unpacked/node_modules/ms → present.

So the collector in app-builder-lib 26.8.x dropped that transitive dep under node-linker=hoisted; #10875 (merged 2026-07-30, after the v1.0.33 release) pinned electron-builder/app-builder-lib to ~26.15.0 and fixed it.

Remaining user impact: main is still at version 1.0.33, so the only Windows installer/auto-update available is the broken one. The remedy is cutting a new Windows release from main — no further code change is required for the crash itself. The durable guard is still worth having: the packaged-artifact probe in #10823 would have blocked publishing 1.0.33 (its ms dependency declaration is now belt-and-braces).

kodjima33 avatar Aug 02 '26 23:08 kodjima33

Follow-up: the broken 1.0.33 package has now been superseded by published Windows 1.0.34 and 1.0.35 installers after the electron-builder fix in #10875. #10854 has also merged, adding ms as a direct runtime dependency plus final-ASAR probes in both unsigned and signed packaging paths, so this exact omission now fails CI before release. The code and release-guard work is complete; this can be closed once the reporter confirms startup on 1.0.35.

tianmind-studio avatar Aug 28 '26 07:08 tianmind-studio

Closing as already fixed on current main.

#10875 pinned electron-builder ~26.15.0; current main Windows package.json is 1.0.35. Kodjima isolated 26.8.1 dropping transitive ms; 1.0.33 artifact superseded.

aryanorastar avatar Sep 20 '26 16:09 aryanorastar