Skip to content

State file could not be read - state.pickle #3488

Description

@randoragon

Problem

I'm unable to import certain directories of my main Music folder into an empty Beets database.
I wanted to learn how Beets works, so I was testing different import options and, if I didn't like the results, I would delete the directory contents along with the *.db file. After having done that a few times, I found myself not being able to import the folders which I were testing earlier, i.e. I was repeatedly adding folder X to the Beets db, and now I can add any other folder from my Music library, but not X.

Running this command in verbose (-vv) mode:

$ beet -vv import --pretend Music/X

Led to this problem:

\user configuration: /home/user/.config/beets/config.yaml
data directory: /home/user/.config/beets
plugin paths: 
Sending event: pluginload
library database: /home/user/.config/beets/library.db
library directory: /home/user/Beets
Sending event: library_opened
Sending event: import_begin
state file could not be read: [Errno 2] No such file or directory: '/home/user/.config/beets/state.pickle'
state file could not be read: [Errno 2] No such file or directory: '/home/user/.config/beets/state.pickle'
Sending event: import_task_created
Album: /home/user/Music/X
  /home/user/Music/X/track1.mp3
  /home/user/Music/X/track2.mp3
  /home/user/Music/X/track3.mp3
Sending event: import
Sending event: cli_exit

Genesis

Now, there's one more complication. The initial errors I had been getting stated that the directory I'm trying to add is already in the Beets database, and thus will be skipped. I had searched for that error and found #2710, which is precisely the issue I had been struggling with, unfortunately, there was no mentioned solution. I tried everything I could (disabling plugins, using no config file at all, reinstalling beets, changing directory locations), but to no avail. That's when I noticed the state.pickle file, which I couldn't identify the purpose of, so I tried deleting it, which triggered the actual errors pasted above. Unfortunately, I accidentally used a permanent delete, so I can't recover the file, and am stuck.

Questions

  1. I'm very confused at the purpose of the state.pickle file. I searched far and wide trying to learn about it, but found nothing other than that it's called a "runtime state file". Could someone explain to me when does it get created, and what kind information it holds?

  2. Since Beets remembers adding folder X at some point, even with the *.db and state.pickle files deleted, there must be some other file that safekeeps this information, right? If that is the case, what other directories does Beets use for storage? I searched through ~/.local/share and ~/.cache, but haven't found anything.

Setup

  • OS: Arch Linux x86_64 Linux 5.5.2-arch2-2
  • Python version: 3.8.1
  • beets version: 1.4.9
  • Turning off plugins made problem go away (yes/no): no

My configuration (output of beet config) is:

directory: ~/Beets

format_item: $artist - $title
format_album: $albumartist - $album
sort_item: artist+ album+ disc+ track+

sort_album: albumartist+ album+
sort_case_insensitive: yes

import:
    write: no
    move: no
    copy: yes
    resume: ask
    incremental: yes
    quiet: no
    from_scratch: no
    log: ~/.config/beets/import.log
    languages: en pl de ja jp
    autotag: yes

paths:
    default: $artist/$title
    singleton: $artist/$title
    comp: Compilations/$title

# I've disabled all plugins on purpose, so pasting plugin configuration seems unnecessary
plugins: []

Interestingly, the error message contains two lines which complain about the state.pickle file. I can make them disappear one by one by setting incremental: no and quiet: yes respectively. However, the music files still don't get imported into the Beets directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needinfoWe need more details or follow-up from the filer before this can be tagged "bug" or "feature."

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions