Repository navigation
Description
What happened
After two media_items rows for the same TMDB id were merged (one anchored movie-imdb-tt…, one movie-tmdb-…), the surviving row's poster/backdrop objects were gone from the S3 bucket. The row still points at the hashed key, metadata_image_cache_jobs still says succeeded, so clients get 404s for the artwork (Android TV renders a blank tile) and a quick refresh does not re-upload. Probing every item matched in a 36 h window on our install found 5 affected out of 2,968 (Blood on the Crown, Little Girl Blue, Fatal Distraction, DOTGA, Everyone Is Lying to You for Money); random samples of older items were all intact. In one of the five cases (Little Girl Blue) the losing row's file was not re-linked either: media_files still carries content_id = movie-imdb-tt26714897 although that media_items row no longer exists, so that version is now invisible.
Steps to reproduce
- S3 artwork caching enabled (
metadata.cache_images = true, public bucket configured). - A movie folder containing two versions of the same film where one file carries an
{imdb-tt…}tag and the other a{tmdb-…}tag (or any other path that yields two rows for one provider id, e.g. a manual re-anchor). Scan. - Let the dedup/re-anchor happen (ours ran at 00:46 and 05:14 UTC without operator action — the second case right after an autoscan-triggered subtree scan of the folder).
GET /api/v1/catalog/items/{surviving id}→poster_urlpoints at…/tmdb/movies/<id>/poster/w300.<hash>.webp; the bucket directorytmdb/movies/<id>/poster/is empty.
Expected behavior
Deleting the losing row must not remove objects that the surviving row (same provider id, same key prefix) still references — or the survivor's artwork should be re-cached after the merge.
Silo version / commit
7c1cb2d (also observed on 90b5c0f)
Deployment
Docker
Clients affected
- Android
- Web UI
- Other/not client-specific (any client — the object is gone)
Relevant logs
No error is logged: the image cache jobs for the survivor show succeeded with an earlier completed_at; the bucket listing is empty; refresh-metadata jobs complete without re-uploading.
Technical notes
internal/catalog/item_repo.go ItemRepository.Delete collects poster_path/backdrop_path/logo_path of the row being deleted and returns imageDeletePrefix(...) dirs for the caller to sweep (internal/scanner/scanner.go orphanedImageDirs → DeletePrefix). Provider-cached keys are scoped by provider id (tmdb/movies/<id>/<type>/…), so when the losing row shares the provider id with the survivor the sweep deletes the survivor's objects. Re-upload never happens because metadata_image_cache_jobs upsert keeps succeeded when source_path is unchanged (enqueueBatchChunk, requeueSucceeded=false). Workaround that works: update metadata_image_cache_jobs set status='queued', attempt_count=0, next_attempt_at=now(), completed_at=null where target_content_id in (…) — the worker re-caches within a minute. Suggested fix: skip the sweep when another live row references the same prefix, or enqueue the survivor's artwork with requeueSucceeded=true after a merge.
AI harness
Claude Code
AI tool(s)
Claude (Anthropic) — investigation and this report; a human operator reviewed before filing.
Activity