Error on startup

Today I get this error when trying to access PhotoStructure:
My version is: 2023.11.0-alpha.1, PhotoStructure for Docker.

Upgrading database (20210930_asset_revision): failed: SqliteError: SQLITE_ERROR: Failed to apply migration models/20210930_asset_revision.sql: CREATE TABLE “AssetRevision” ( – Any change made to an Asset through the PhotoStructure UI creates an “AssetRevision” which can then be merged with any external changes made to files or side…d) REFERENCES Asset (id) ): table “AssetRevision” already exists¹

SqliteError: SQLITE_ERROR: Migrating the models db failed: Failed to apply migration models/20210930_asset_revision.sql: CREATE TABLE “AssetRevision” ( – Any change made to an Asset through the PhotoStructure UI creates an “AssetRevision” which can then be merged with any external changes made to files or sidecars. id INTEGER NOT N…d) REFERENCES Asset (id) ): table “AssetRevision” already exists¹

Thanks in advance.

First off: apologies for the inconvenience! Software bugs are always frustrating.

Note that this migration will only fail if the migrations table got truncated, which would cause the 20210930_asset_revision.sql migration to be applied twice.

If your migrations table is truncated, much worse things are afoot–somehow your library database has lost information, and is in an unknown state. The v2.1 branch had some circumstances that could result in invalid backups, and the v2023.11 branch addresses all known issues like that.

It may be fastest to restart from an empty library, using this new version:

  1. Shut down your PhotoStructure container
  2. On your host OS, navigate to the directory that is bind mounted to /ps/library
  3. Delete or move the .photostructure subdirectory. This directory contains your library db, sync-reports, previews, and may contain logs and PhotoStructure caches–feel free to verify that nothing in that directory structure is important before your delete it. You can also rename .photostructure to .photostructure-off or .old if you’re nervous about it, and delete it later.
  4. Restart your PhotoStructure container, and re-import your library.

Holler if there’s any glitches, and feel free to ask on the discord chat, too.

Now i get this error:
Your library directory, /photo , can’t be set up for user root (userid 0).
But in environment variables i set:
This works in the past…


PUID/GUID=0 means run as root according to PhotoStructure | PhotoStructure for Docker, which is not recommended.

I wrote Synology NAS Tips - #6 by nuk walking through on my Synology DS920+ with DSM 7.2 for creating a non-root user and getting it’s PUID+GUID for a Synology docker. I guess if @mrm wants to support running as root he’ll have to investigate this further, but I know other software explicitly won’t run as root so I could see him going either way.

Also see the next comment after that for how I set up my docker container in general, in case that’s helpful to you.

Thanks for your response, but so many steps to something that must be need to be more easy.
Why when I setup this before it works, and now not?

Perhaps there was an update to Synology that changed how it behaves with the root user (PUID 0). Unraid made a similar change ~6 months ago.

It’s a lot of steps. But mostly because I’m very explicit in my steps! I would say it should only take you only a few minutes.


Now it works, but in the last days it says always this:

  • Processed 149 photos and 2 videos. 2,534 remain to be processed

And it does not update…


Apologies for how many glitches you’re hitting!

There are a couple ways to debug what’s going on:

  1. The last sync report may provide a clue as to what’s causing your sync to get “stuck.” Those are in $librarydir/.photostructure/sync-reports. More details are here: PhotoStructure sync reports

  2. Debug logs from the sync process may also provide some information: you need to shut down PhotoStructure, set your PS_LOG_LEVEL=debug, restart the container, wait for sync to get “stuck” again, and then send me the sync log from $librarydir/.photostructure/logs/$todays_date/. More details are here: PhotoStructure | What are in my logs and error reports?

I setup the debug mode, and now it seems that the resync process starts correctly:

  • /photo/2007/08/16/16082007022.mp4
  • Scanning /photo/2023/07
  • Processed 33 photos and 3 videos. At least 2,600 remain to be processed

I wait until the process end or stuck again.


Now is stucked:

  • Processed 150 photos and 4 videos. 2,527 remain to be processed

I attached the logs.


1 Like

Thanks for attaching the sync report!

I just edited your comment to remove the link, as the CSV does contain filenames from your library.

If you open that CSV in Google Sheets or Excel or LibreOffice Calc, and scroll through, you’ll see that the vast majority of your files are imported, and the “Precheck” is saying the file is already imported in your library.

If you skip to line 42507, things get a bit more interesting: you’ve got ~75 corrupt JPEGs in the /photo/2023/07/08/ directory (if you send me a zipfile with one of those files, I can verify that they are indeed corrupt), and the last line is probably what is getting things stuck: /photo/2007/08/17/17082007023.mp4 is started to process, and no subsequent line is emitted, which indicates PhotoStructure never heard back from ffmpeg when it asked to transcode that file.

If you want to share that file with me, (only if it doesn’t have anything private), I can see if I can reproduce the ffmpeg hang on my test box. Any other information about your test box may help us get to a reproducible error–only then I can figure out a workaround.