Repository navigation
Description
What happens
A script widget subscribed to a distributed notification crashes StableBar when the notification's payload holds a date, or any other value JSON can't hold, such as data.
Steps to reproduce
- Add a script widget with
"events": ["com.apple.Music.playerInfo"]. - Have an app post that notification with a date in its
userInfo.
A scratch test that runs the same conversion on a payload with a Date stops with Invalid type in JSON write (__NSTaggedDate).
Expected
The bar keeps running, and the script gets INFO as JSON, with dates kept in a JSON form and only values JSON can't represent left out.
Environment
main at ca6262d (after v0.17.0), macOS 27.2.1.
Evidence
Invalid type in JSON write (__NSTaggedDate), an uncaught Objective-C exception.
Music's app contains a Play Date string, so com.apple.Music.playerInfo likely carries a date. Not observed directly: playing music was off limits.
Diagnosis
Sources/StableBar/BarStore.swift:815 turns the notification's userInfo into INFO with try? JSONSerialization.data(withJSONObject: info, options: [.sortedKeys]). JSONSerialization raises an Objective-C exception, not a Swift error, for values it can't encode (dates, data, NaN), so try? doesn't catch it and the process stops. Distributed notification payloads are property lists, which can hold dates and data.
No other call reaches JSONSerialization.data(withJSONObject:) with outside data: SceneRenderer.swift:464 writes its own sample data, and the other calls only read JSON.
Related
- List the macOS notifications that widget scripts can subscribe to #303 / docs: list macOS notifications that widget scripts can subscribe to #737 list
com.apple.Music.playerInfoin the guide for scripts, so people following that page could hit this. docs: list macOS notifications that widget scripts can subscribe to #737 notes the crash in its testing section. - Trigger and notification data can replace PATH and other variables widget commands rely on #5 kept notification data from replacing shell variables; it touched the same code but not the
INFOconversion.
Triaged by Claude Code (Claude Opus 5.5).
Activity
stablebar-releases commentedon Nov 20, 2026
🎉 This issue has been resolved in version 0.18.0 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀