Photostructure fails to launch

It was taking a super long time to rebuild after updating to beta-9, and then it stopped working with this error. Do I need to delete database and rebuild all from scratch?

{“fatal”:true,“exit”:true,“status”:14,“pid”:23,“ppid”:11,“error”:“main setup failed: Error: ModelDbJanitor(/ps/library/.photostructure) {“from”:“ModelDbJanitor.setup”}: Failed to set up /ps/tmp/local-db/models/db.sqlite3: SqliteError: code SQLITE_CORRUPT: database disk image is malformed¹⁶”}
{“fatal”:true,“exit”:true,“status”:12,“pid”:19,“ppid”:7,“error”:“Library.setup() failed: ¹: Error: ModelDbJanitor(/ps/library/.photostructure) {“from”:“ModelDbJanitor.setup”}: Failed to set up /ps/tmp/local-db/models/db.sqlite3: SqliteError: code SQLITE_CORRUPT: database disk image is malformed¹⁶”}
Error: ModelDbJanitor(/ps/library/.photostructure) {“from”:“ModelDbJanitor.setup”}: Failed to set up /ps/tmp/local-db/models/db.sqlite3: SqliteError: code SQLITE_CORRUPT: database disk image is malformed¹⁶
SqliteError: database disk image is malformed
at Database.pragma (/ps/app/node_modules/better-sqlite3/lib/methods/pragma.js:10:27)
at /ps/app/bin/main.js:9:662110
at Object.t.handleDbRetriesSync (/ps/app/bin/main.js:9:650840)
at h (/ps/app/bin/main.js:9:662065)
at Object.t.mkdb (/ps/app/bin/main.js:9:662447)

Is your /ps/library bind mount on a local disk? If so, see this:

https://forum.photostructure.com/t/crash-on-initial-scan/727/8?u=mrm

(The mentioned fix just routes around the actual issue, which I’ll poke at tomorrow).

I changed forceLocalDbReplica = false in the toml file but same problem when I relaunch photostructure.
Do I have to blow away the db and/or other files? If so, which files?

If you want to restart from scratch, you can delete the entire .photostructure directory in your library and restart the container.

(As @avdp suggests below, I mostly use environment variables for my test libraries because it makes restarting from scratch almost a no-op).

If you’re blowing everything away and you’re using docker, I’d recommend using the env variable rather than the settings file. Those get blown away and recreated as well. I made this mistake once, doh!

PS_FORCE_LOCAL_DB_REPLICA=false

Will do. I’ll change it in the docker-compose file.

Now, a strange thing is happening, which is the photos appear to be getting copied into the local PS library. This wasn’t happening before. Did something change recently?
I don’t want this behavior because my drive is now full but I want to make abslutely sure I still have my originals before blowing this library away. I’m assuming there is no way an original can be deleted by PS, correct?

PhotoStructure will copy unique photos and videos into your library directory if the copyAssetsToLibrary system setting is set to true. You can verify this by visiting your settings page.

Please make sure you have a full backup before doing any mass-deletes. It’s cheap insurance and makes everything a lot less stressful.

  1. It’s always safe to delete the .photostructure directory in your PhotoStructure library (if you don’t mind completely re-importing your library): it only contains preview images, transcoded videos, and your database. It won’t ever contain original assets.

  2. If you set your PhotoStructure library to be a previously-existing directory with photos and videos, it won’t have made copies of your originals: don’t delete that directory!

Lots more details about disk space (and some tips on how to minimize disk usage) here:

Okay, cool. Thanks. I blew the old .photostructure directory away and made room on the drive, and everything is rebuilding.
Just to be clear, something did change somewhere that caused photostructure to start copying to the library but I’m not sure what it was. I think I upgraded from beta 2 to beta 8 to beta 9 (when I went to beta 8, beta 9 did exist but it was not getting pulled by docker)

PhotoStructure should require you to go through the settings page before it starts the first sync.

Note that the setting is forced to false if you don’t have an active PhotoStructure PLUS subscription (as automatic organization is a plus-only feature).