Where data lives
The server keeps its state in a few files in two folders. This page helps you find which file holds what, which controller owns it, and what you must do when your change touches stored data.
The two folders
Section titled “The two folders”flowchart LR
subgraph D["Data folder"]
SET["settings.json"]
LIB["library.db"]
AUTH["auth.db"]
AA["audio_analysis.db"]
LOG["musicassistant.log"]
CP["community_providers/"]
end
subgraph K["Cache folder"]
CACHE["cache.db"]
THUMB["thumbnails/"]
DEPS["community_deps/"]
end
CFG["mass.config"] --> SET
MUS["mass.music"] --> LIB
WEB["mass.webserver"] --> AUTH
STR["mass.streams"] --> AA
CC["mass.cache"] --> CACHE
How to read this
Section titled “How to read this”The left box is the data folder, the right box the cache folder. An arrow points from the controller that owns a file to the file. What is in the data folder must survive: losing it costs the user their settings, library or accounts. What is in the cache folder can be rebuilt, at the cost of time and requests to services.
The data folder is --data-dir, by default ~/.musicassistant (or $XDG_DATA_HOME/music-assistant). The cache folder is --cache-dir, by default .cache inside the data folder (or $XDG_CACHE_HOME/music-assistant).
The files
Section titled “The files”| File | Folder | Owner | Versioned and migrated by |
|---|---|---|---|
settings.json |
data | mass.config |
No version number. migrate() in controllers/config/migrations.py runs at every load; each step checks whether it still has work to do. The previous file is kept as settings.json.backup. |
library.db |
data | mass.music |
DB_SCHEMA_VERSION in controllers/music/constants.py, steps in migrate_database (controllers/music/migrations.py). The file is backed up before a migration. A failed migration starts a fresh database, which means a full rescan for the user. |
cache.db |
cache | mass.cache |
Its own DB_SCHEMA_VERSION in controllers/cache/constants.py. A failed migration drops the cache table and starts empty. |
auth.db |
data | mass.webserver (AuthenticationManager) |
Users, tokens and the secret that signs tokens. DB_SCHEMA_VERSION and _migrate_database in controllers/webserver/auth.py. |
audio_analysis.db |
data | mass.streams (AudioAnalysisController) |
AA_DB_SCHEMA_VERSION in controllers/streams/constants.py. A file from a newer version is refused, an unusable one is moved aside. |
musicassistant.log |
data | __main__.py |
Rotated at every start. Clients read it with the logging/get command. |
community_providers/ |
data | mass.community_catalog |
Installed community providers, with the catalog’s index.json and state.json. |
community_deps/ |
cache | mass.community_catalog |
The Python requirements of the community providers. |
thumbnails/ |
cache | mass.metadata |
Resized images. |
Some state lives inside these files rather than in a file of its own:
- The queues of the players are kept in
cache.db, so they survive a restart. - The state of scheduled tasks (last run, paused or not) is kept in
settings.json. - Play statistics come from
library.db; the statistics controller has no file of its own. - The data folder also holds smaller folders, such as
custom_images/(images a user set) anddsp_irs/(impulse responses for DSP).
All databases are SQLite, opened through DatabaseConnection in helpers/database.py. When debugging, query a live database with SELECT only; never write to it.
A change to stored data needs a migration
Section titled “A change to stored data needs a migration”IMPORTANT
A renamed config key, a changed type, a value that moves scope, a dropped column: none of it fails a test or hurts a new install. It only breaks installs that already hold data, and table creation code never repairs those.
So when your change touches stored data, it needs a migration step. Do not decide how alone and do not leave it for the review: raise it with a maintainer before the work counts as done. The server’s AGENTS.md sets the rules:
- A migration step runs once, against data written by a version you cannot inspect.
- Make it idempotent, let it survive missing and half-written values, and never let it raise.
- A failed library migration resets the database and costs the user a full rescan.
A schema change that is backported to the stable branch needs extra care, because the schema version then means something different on each branch. The music README explains what to do.
Read deeper
Section titled “Read deeper”- music README: schema migrations and the
devversusstableversions. - cache README: how the cache stores and expires entries.
- community_catalog README: the on-disk layout of community providers.
- webserver README: authentication and its database.
- Library, sync and metadata and Inside the server
Music Assistant is a project of the Open Home Foundation.