Duplicate/upgrade matching hits another user's assets despite per-owner scoping (Cluster Groups active)
Summary
Running immich-go upload from-google-photos against User B's account (a brand-new
account with zero existing assets) produces "server asset upgraded" events that match
files actually owned exclusively by a different account, User A, on the same Immich
instance. Confirmed directly via SQL against the asset table — the matched file has
exactly one row in the database, owned by User A, with no corresponding row (active or
trashed) under User B.
This appears to contradict documented behavior: duplicate detection is described as
strictly per-owner (see #22618, #148), enforced by the UQ_assets_owner_checksum
unique constraint. This report includes the ruled-out causes below in case it saves
triage time.
Environment
- immich-go: v0.32.0
- Immich server: v3.2.1
- Server OS: Ubuntu 24.04, self-hosted, single Docker host
Context / setup
- Two user accounts on the same instance: User A (large existing library, ~37k assets) and User B (newly created, 0 assets at time of test).
- The two accounts had Immich's built-in Partner Sharing enabled at some point prior to testing (both directions).
- The two accounts are members of the same Cluster Group (v3.2 feature).
- Google Takeout export for User B contains some photos that match, by filename, capture date, and file size, assets already present in User A's library. Per direct DB query, the matching asset in User A's account was created in Immich months before this session (well prior to today), so it did not come from a Google Takeout import done today — its original upload method is unconfirmed.
Steps to reproduce
- Create/confirm User B has 0 assets in Immich.
- Confirm Partner Sharing and Cluster Group membership as above.
- Generate a fresh API key under User B's own account (confirmed via direct DB
query afterward:
api_key.userIdmatches User B'suser.id). - Run:
immich-go upload from-google-photos --server=... --api-key=<User B's key> --admin-api-key=<admin key, job-pause only> --people-tag=false --include-partner=false --dry-run /path/to/User_B_takeout-*.zip - Observe "server asset upgraded" events in the log for files matching User A's existing library by filename/date/size.
Expected behavior
Duplicate/upgrade matching against User B's key should only ever consider assets owned by User B.
Actual behavior
Matches (and "server asset upgraded" writes, in dry-run they're simulated but reported) occur against assets that direct SQL confirms are owned solely by User A.
Ruled out during diagnosis
- Google Photos Partner Sharing — confirmed off/negligible on both source Google accounts.
- Immich Partner Sharing — confirmed ON initially (both directions), then disabled entirely and the dry run re-run: match count was unchanged (184 → 185), ruling this out as the cause.
- Wrong/stale API key value — verified char-for-char correct length (43 chars,
matches Immich's generated key format), and confirmed via direct SQL query
(
api_key.userId) that the key used is genuinely owned by User B, not User A. - Admin key bypass — the
--admin-api-keyis a separate, distinct value used only for job pause/resume; confirmed not equal to the--api-keyvalue. - Cluster Group causing visibility leakage — per maintainer statement in immich-app/immich#31408 discussion, clustering is stated to be fully isolated from asset visibility, "including thumbnails." Not tested by disabling (doing so requires a destructive facial-recognition reset for all group members), but flagging Cluster Group membership here since it's the one variable in this setup not covered by existing per-user-scoping discussions, and its recency (v3.2) means an interaction wouldn't necessarily be well-tested yet.
Direct database confirmation
Query used:
SELECT a.id, u.email, a."originalFileName", a.status, a."deletedAt"
FROM asset a JOIN "user" u ON u.id = a."ownerId"
WHERE a."originalFileName" ILIKE '%<filename>%';Result: exactly one row, owned by User A's account. Zero rows for User B, including trashed/soft-deleted.
Additional notes
- This was caught in
--dry-runmode, so no data was actually modified. Happy to provide--log-level=DEBUG --api-traceoutput, sanitized, if useful for diagnosis. - The real (non-dry-run) import has not yet been run pending this report; will
update with a post-import DB check of the affected asset's
ownerId/checksumto confirm whether the write side of "upgrade" respects ownership boundaries even when the read/match side apparently does not.
Source: simulot/immich-go