music-assistant-server

Branch:dev-lidarr-plugin

Commit Details

Clean up sidebar shortcuts when a music provider is removed (#6124)

# What does this implement/fix?

When you remove and recreate a music provider (e.g. YT Music), stale
references to the old provider instance ID cause "provider isn't
currently available" popups on every page load.

This fixes the problem in two ways:

**Shortcut cleanup on provider removal:**
When a provider is removed, sidebar shortcuts that reference it are
rewritten to point at the library copy of the item if one exists, or
removed if it does not. Library shortcuts for items that no longer exist
are also pruned after a sync finishes.

**Stale instance ID fallback in get_provider:**
When a stored reference uses an old instance ID that no longer exists,
`get_provider` now extracts the domain from the ID and falls back to
another instance of the same streaming provider. This handles all stored
references (shortcuts, queue items, playlog) without needing to find and
clean each one individually. Non-streaming providers are excluded from
this fallback since their data is account-specific.

- Shortcut cleanup method on the auth manager
- Provider and library shortcut cleanup wired into the removal flow and
sync completion
- get_provider handles deleted streaming provider instance IDs by domain
extraction

**Related issue (if applicable):**

- related issue https://github.com/music-assistant/support/issues/6256

## Types of changes

- [x] Bugfix (non-breaking change which fixes an issue) — `bugfix`
- [ ] New feature (non-breaking change which adds functionality) —
`new-feature`
- [ ] Enhancement to an existing feature — `enhancement`
- [ ] New music/player/metadata/plugin provider — `new-provider`
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected) — `breaking-change`
- [ ] Refactor (no behaviour change) — `refactor`
- [ ] Documentation only — `documentation`
- [ ] Maintenance / chore — `maintenance`
- [ ] CI / workflow change — `ci`
- [ ] Dependencies bump — `dependencies`

## Checklist

- [x] The code change is tested and works locally.
- [x] `pre-commit run --all-files` passes.
- [x] `pytest` passes, and tests have been added/updated under `tests/`
where applicable.
- [ ] For changes to shared models, the companion PR in
`music-assistant/models` is linked.
- [ ] For changes affecting the UI, the companion PR in
`music-assistant/frontend` is linked.
- [x] I have read and complied with the project's [AI
Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md)
for any AI-assisted contributions.
- [ ] I have [raised a PR against the documentation
repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md)
targeting the main or beta branch as appropriate.
Forgejo

Author

September 3, 2026 at 07:21 AM UTC

Committer

Marvin Schenkel<[email protected]>
September 4, 2026 at 07:55 AM UTC
247additions
1deletions
4files changed

Parent commits

Changes

4 files
+247-1

Changed Files (4)

music_assistant/controllers/config/
music_assistant/controllers/music/
music_assistant/controllers/webserver/
tests/
music_assistant/controllers/config/providers.py
music_assistant/controllers/music/controller.py
+46
music_assistant/controllers/webserver/auth.py
+3-1
tests/test_shortcut_cleanup.py
+198