Skip to content

macOS: native helper crashes when NSHTTPURLResponse is bridged as a window-title string #144

Description

@Gleek

Environment

  • ActivityWatch: 0.14.0b5
  • Installation: Homebrew activitywatch@beta
  • macOS: 15.7.3 (24G419)
  • Architecture: Apple Silicon, native arm64 (translated: false)
  • Hardware model: Mac15,6

Problem

After running normally for approximately four days, aw-watcher-window-macos crashed while handling a focused application/window change. Window tracking stopped, while ActivityWatch, aw-watcher-afk, and aw-sync continued running.

The last window event was recorded at 2026-09-14 17:33:53 +0530. The crash occurred at 17:33:55.

Crash

The macOS crash report shows:

NSInvalidArgumentException:
-[NSHTTPURLResponse length]: unrecognized selector sent to instance

Relevant stack frames:

static String._unconditionallyBridgeFromObjectiveC(_:)
MainThing.windowTitleChanged(_:axElement:notification:)
MainThing.focusedWindowChanged(_:window:)
MainThing.focusedAppChanged()

The process terminated with EXC_CRASH / SIGABRT on the main thread. This appears to mean that an Objective-C API returned an NSHTTPURLResponse where the Swift code expected a string, and the value was bridged without validating its runtime type.

Restart behavior

The Tauri manager logged:

[2026-09-14 17:33:55][INFO][aw_tauri_lib::manager] Stopped module: aw-watcher-window
[2026-09-14 17:33:55][INFO][aw_tauri_lib::manager] Module aw-watcher-window exited successfully

The native helper crashed, but the Python wrapper apparently exited with status 0. The manager therefore considered it a successful exit and did not restart the window watcher.

The silent exit/restart symptom resembles #101. The one-shot helper lifecycle and failure to restart are also discussed in #139, but the NSHTTPURLResponse exception appears to be a separate crash cause.

Expected behavior

  1. Unexpected Accessibility or ScriptingBridge return types should be handled without crashing.
  2. If the native helper crashes, the wrapper should return a failure status so the module manager can restart it.

Reproduction

No reliable reproduction yet. It occurred during an application/window focus change after several days of normal operation.

I have a macOS .ips crash report, but have not attached the raw file because it contains persistent device/session identifiers. I can provide a sanitized version if useful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions