get_dock_badge_for stops getting correct data after a while

Describe the bug
I’m using code like these to check if Slack/Mail has unread every 2s and show alternative menubar icons.

if application "Slack" is running then
	tell application "BetterTouchTool"
		set badgeNumber to get_dock_badge_for "Slack" update_interval 1
	end tell
	if badgeNumber is not missing value then
		return "unread"
	end if
end if

return "read"

it works well initially, unread/read changes as app state changes. However, after a while it just stops updating. e.g. the current screenshot of dock:

Screenshot 2026-01-19 at 09.55.46

but script for Slack and Mail returns read and unread

Now if I restart BTT, everything works as expected again.


Affected input device (e.g. MacBook Trackpad, Magic Mouse/Trackpad, Touch Bar, etc.):


Screenshots
If applicable, add screenshots to help explain your problem. (You can just paste or drag them here)


Device information:

  • Type of Mac: M1
  • macOS version: 26.2
  • BetterTouchTool version: 6.067

Additional information (e.g. crash logs, related issues, etc.):