Skip to content

Legacy LauncherApplication cleanup fails on upgrade from the App Store build (22: Invalid argument) but is marked done #456

Closed

Description

@openjay

Describe the bug

After upgrading from the App Store build (1.8) to the GitHub build v1.11.1 on macOS 27, the one-shot cleanup in AppDelegate.removeLegacyLauncherLoginItem() does not remove the old com.dwarvesv.LauncherApplication login item, and the app still records the migration as done, so it is never attempted again.

The docs say this should happen automatically:

  • docs/MANUAL.md: "A ghost "LauncherApplication" login item from old versions → Launch the current version once; it deauthorizes the legacy item automatically"
  • CHANGELOG.md: "any leftover login item is deauthorized automatically on first launch"

Steps to reproduce

  1. macOS 27.0.1 (Apple silicon), Hidden Bar 1.8 (12) from the App Store with launch at login turned on, and at least one login since, so the helper job ran.
  2. Quit it and put v1.11.1 from the GitHub release in /Applications. (I renamed the old bundle aside instead of deleting it.)
  3. Launch v1.11.1 once and read the log (Console, or log show).
  4. Look at the helper job: launchctl print gui/$(id -u)/com.dwarvesv.LauncherApplication.
  5. To re-run: quit, delete the smAppServiceMigrated key from the com.dwarvesv.minimalbar preferences, launch again.

Expected behaviour

The legacy item is removed. If that can't be done, the failure is visible and smAppServiceMigrated is left unset.

Actual behaviour

  • The first launch after the upgrade and the re-run in step 5 both log (process IDs removed):

    Hidden Bar: (ServiceManagement) Could not enable login item: com.dwarvesv.LauncherApplication: 22: Invalid argument
    

    That is 2 of 2 runs. The first was right after the replacement. For the second, Launch Services knew the old helper again at the renamed bundle's path (the log shows it registered about 20 minutes before that run, and it is still listed right after). The result was the same.

  • After both runs the job is still there. launchctl print shows type Submitted, managed by com.apple.xpc.ServiceManagement, parent bundle identifier = com.dwarvesv.minimalbar, parent bundle version = 12, and launchctl print-disabled gui/<uid> lists it as enabled.

  • smAppServiceMigrated is true afterwards even though the call failed.

What the code does

hidden/AppDelegate.swift at 47937b9:

guard !UserDefaults.standard.bool(forKey: migratedKey) else { return }
SMLoginItemSetEnabled("com.dwarvesv.LauncherApplication" as CFString, false)
UserDefaults.standard.set(true, forKey: migratedKey)

The Boolean result is ignored and the flag is set unconditionally. The v1.11.1 bundle has no Contents/Library/LoginItems, since the helper target was removed in #362. Apple documents SMLoginItemSetEnabled as acting on a helper in the calling app's Contents/Library/LoginItems. I haven't confirmed that this is why it returns 22, so take it as a guess.

#362 lists the upgrade-path run from a launcher-era build as outstanding. This is one such run.

Questions

  • Is the automatic cleanup expected to work when upgrading from the App Store build? If not, should the docs say how to remove the leftover item?
  • Should smAppServiceMigrated stay unset when the call fails?

Not verified

  • I haven't had a login since the upgrade, so I don't know whether the leftover job does anything at login.
  • I haven't checked how it shows up in System Settings > General > Login Items & Extensions, or whether removing it there works.
  • One machine, one upgrade path (App Store 1.8 → v1.11.1).

Environment

  • macOS 27.0.1, Apple silicon (arm64)
  • Hidden Bar 1.8 (12) from the App Store → v1.11.1 (16) from the GitHub release

Activity

  1. tieubao commented on Nov 15, 2026

    @tieubao
    Contributor

    Fixed in #468. The legacy login item cleanup is now marked done only when macOS reports success, and it retries on the next launch otherwise (unit tested). It ships in the next release; we will close this then.

  2. tieubao commented on Nov 15, 2026

    @tieubao
    Contributor

    Fixed in v1.11.2: https://github.com/dwarvesf/hidden/releases/tag/v1.11.2 (download, or brew upgrade --cask hiddenbar once Homebrew picks it up). Please reopen if you still see this on 1.11.2.

  3. added 2 commits that reference this issue on Nov 16, 2026
  4. tieubao commented on Nov 16, 2026

    @tieubao
    Contributor

    Reopening: we reproduced this on 1.13.0.

    We upgraded a clean macOS 27.2.1 machine from v1.9 (launch at login on) to 1.13.0. After a fresh login, the old LauncherApplication login item is still registered, and every launch logs Could not enable login item: com.dwarvesv.LauncherApplication: 22: Invalid argument. System Settings does not give it a row of its own: it is listed inside the "Hidden Bar" entry under Allow in the Background.

    Workaround until the fix ships: open Hidden Bar Settings, turn "Open Hidden Bar at login" off, then on again. In our test that removed the old item.

    Edit: the fix is merged in #517 and will ship in the next release.

  5. tieubao commented on Nov 19, 2026

    @tieubao
    Contributor

    Hidden Bar 1.13.2 is out: https://github.com/consolelabs/hidden/releases/tag/v1.13.2

    The cleanup of the old LauncherApplication login item now runs again on Macs that passed through 1.11 or 1.11.1, where it had been marked done even when it failed. We ran the upgrade path v1.10 to 1.11.1 to 1.13.2 on macOS 27.2.1 and no LauncherApplication record remained. If the item is still listed for you after 1.13.2 has launched twice, please reopen.

  6. added a commit that references this issue on Nov 24, 2026
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