Skip to content

A script event whose notification carries a date crashes the bar #748

Closed

Description

@Seb-GRAF

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

  1. Add a script widget with "events": ["com.apple.Music.playerInfo"].
  2. 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

Triaged by Claude Code (Claude Opus 5.5).

Activity

  1. added
    bug
    on Nov 16, 2026
  2. stablebar-releases commented on Nov 20, 2026

    @stablebar-releases

    🎉 This issue has been resolved in version 0.18.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

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

    bugreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions