BUG: Replacing an image at the same path retains stale AI metadata
Maintainers usually reply within 4 days
@risingsamurai is already working on this.
Since Nov 20, 2026.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start from the folder-synchronization code that detects a changed file and prepares the updated image record, then follow it into the database upsert keyed on the image path. Check which fields the upsert preserves — particularly isTagged, isEmbedded, GPS and the related tag/face/embedding records — and decide what must be reset or deleted when content changes. Reproduce by adding an image, letting AI processing finish, replacing the file at the same path, and re-running sync; done means fresh processing is scheduled and a regression test covers the same-path replacement.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
When an existing image is replaced with different image content at the same filesystem path, PictoPy may retain the previous image's AI-generated metadata and processing state.
The synchronization logic detects the changed file and prepares an updated image record. However, when the database performs an upsert using the existing image path, the existing record's ID and AI-processing flags may be retained instead of being reset for the new content.
Consequently, the replacement image may continue using the previous image's tags, embeddings, face information, or semantic metadata, and may not be scheduled for fresh AI processing.
Steps to Reproduce
- Add an image to PictoPy.
- Allow AI tagging and embedding generation to finish.
- Record the image's existing AI tags and processing state.
- Replace the image file with completely different content while keeping the same filename and filesystem path.
- Trigger folder synchronization.
- Inspect the updated image record and its associated AI data.
- Verify whether the replacement image receives fresh AI processing.
Expected Behavior
When PictoPy detects that image content has changed:
- The previous content's AI-generated metadata should not be associated with the replacement image.
- Relevant AI-processing flags should be reset.
- Old tags, face records, and embeddings associated with the previous content should be invalidated or replaced.
- The replacement image should be scheduled for fresh AI processing.
- Metadata such as GPS coordinates should reflect the replacement file rather than retain stale values.
Actual Behavior
The database upsert appears to preserve the existing image identity and AI-processing flags when a record with the same path already exists.
In particular, existing isTagged and isEmbedded values may remain true even when the image content has changed.
This can prevent the replacement image from entering normal AI-processing pipelines, while existing AI-generated metadata and related records remain associated with the image's database identity.
As a result, the gallery, tagging, face-related data, or semantic search may continue reflecting the original image instead of the replacement content.
Impact
- Incorrect AI tags may remain attached to replaced images.
- Face-related metadata may describe the previous image.
- Image embeddings may represent outdated content.
- Semantic search may return results based on the previous image.
- Replacement images may be skipped by AI-processing queues if their flags indicate that processing has already completed.
Suggested Fix
When a same-path image replacement is detected:
- Update or invalidate content-dependent AI metadata.
- Reset AI-processing flags so the replacement is processed again.
- Remove or regenerate stale embeddings, face records, and semantic metadata.
- Ensure GPS and other file-derived metadata are updated correctly, including clearing values that are no longer present.
- Add regression tests for replacing an already-processed image with different content at the same path.
Record
- I agree to follow this project's Code of Conduct
- Dominant language
- Python
- Stars
- 322
- Forks
- 793
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 20
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AOSSIE-Org/PictoPy
-
BUG: Semantic search sees portrait phone photos sideways (SigLIP ignores EXIF orientation)Possibly taken @jayssSmm claimed this 1 day ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
AOSSIE-Org/PictoPy#1780 · 5 comments ·
Maintainers usually reply within 4 days
-
BUG: Share password loses leading/trailing spaces so the password you set doesn't workPossibly taken @swastiksharma45 claimed this 2 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
AOSSIE-Org/PictoPy#1779 · 2 comments ·
Maintainers usually reply within 4 days
-
BUG: PROD: Face search shows "No Matches Found" for every empty result, even when AI tagging is offPossibly taken @dhruvbit claimed this 3 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AOSSIE-Org/PictoPy#1770 · 3 comments ·
Maintainers usually reply within 4 days
-
BUG: Add images to album: success message shows requested count, not number actually addedPossibly taken @riyanshbhosale claimed this 5 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
AOSSIE-Org/PictoPy#1740 · 4 comments ·
Maintainers usually reply within 4 days
-
BUG: /sync-folder does not validate the supplied folder_idMay be free again @sathvikn113 claimed this 10 days ago, and no pull request is open. Openbug possible-duplicate
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AOSSIE-Org/PictoPy#1731 · 5 comments ·
Maintainers usually reply within 4 days
All issues in AOSSIE-Org/PictoPy
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
bad-antics/lateralus-lang#1140 ·
Maintainers usually reply within 4 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days
-
fixture good first issue help wanted vendor:cisco
Difficulty 1/5 1-3 hours Newbie friendliness 85/100