music-assistant-server

Branch:dev-lidarr-plugin

Commit Details

Keep core/tasks parsable when the scheduler persists its state (#6145)

# What does this implement/fix?

<!-- Quick description and explanation of changes. -->
The tasks controller persists scheduler state with a raw path write to
`core/tasks/scheduled_task_states`. `ConfigController.set()` creates
missing parents on the fly, so on a fresh install - where the block does
not exist yet - that write was what created it, leaving a stub without
the 'domain' key that CoreConfig requires. `get_core_configs()`
(Settings -> System) then failed with "Field 'domain' of type str is
missing in CoreConfig instance".

The existing repair in `migrate()` cannot cover this as `_load()`
returns early with "Started with empty storage" when there is no
`settings.json` yet, so on a first run nothing repairs the block the
startup task registrations write. It only heals on the next restart,
which is why this looks intermittent.

Fix the write path so a raw write can no longer leave a domain-less
stub, and make the core config list read fill in a missing 'domain' the
same way the single core config read already did, so installs already
carrying such a stub render their settings again before that restart.

**Related issue (if applicable):**

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

## Types of changes

<!--
Tick exactly one box. CI (.github/workflows/pr-labels.yaml) derives
the label from the ticked box and applies it automatically; the
release-notes generator uses that same label to slot this change
into the next release notes.
-->

- [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 2, 2026 at 01:46 PM UTC

Committer

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

Parent commits

Changes

3 files
+80-12

Changed Files (3)

music_assistant/controllers/config/
music_assistant/controllers/tasks/
tests/controllers/config/
music_assistant/controllers/config/core.py
+3-12
music_assistant/controllers/tasks/controller.py
tests/controllers/config/test_core_config_resilience.py
+77