-
-
Notifications
You must be signed in to change notification settings - Fork 188
Open
Description
Hello!
During the import of a Google takeout with immich-go I experience several errors in the immich app logs:
error: PostgresError: insert or update on table "stack" violates foreign key constraint "stack_primaryAssetId_fkey".
I opened immich-app/immich#25132 over at immich-server, but in the comment immich-app/immich#25132 (comment) it was suggested that this might be a problem of immich-go.
Versions:
- Immich: v2.4.1
- immich-go: 0.31.0
- PostgreSQL 17
I used this CLI command to import:
./immich-go upload from-google-photos \
--server=https://photos.example.com \
--api-key=<redacted> \
--manage-raw-jpeg=StackCoverRaw \
--manage-burst=Stack \
--concurrent-tasks=4 \
--client-timeout=60m \
--pause-immich-jobs=true \
takeout-*.zip
Reproduction steps
- Deploy latest immich version v2.4.1 (with Postgres 17.x database backend)
- Create Google takeout with stacks (or any other photo stack for that matter)
- Import takeout
- Experience import errors when creating stacks
Relevant log output
immich-go
2026-01-08 16:44:04 INF server has duplicate file=takeout-20260107T170725Z-3-001:Takeout/Google Photos/01.06.13/IMG_20130601_110512-edited.jpg
2026-01-08 16:44:04 INF metadata updated file=takeout-20260107T170725Z-3-001:Takeout/Google Photos/01.06.13/IMG_20130601_110512-edited.jpg
2026-01-08 16:44:04 INF added to album file=takeout-20260107T170725Z-3-001:Takeout/Google Photos/01.06.13/IMG_20130601_110512-edited.jpg album=01.06.13
2026-01-08 16:44:05 INF added to album file=takeout-20260107T170725Z-3-001:Takeout/Google Photos/01.06.13/IMG_20130601_110512.jpg album=01.06.13
2026-01-08 16:44:05 INF tagged file=takeout-20260107T170725Z-3-001:Takeout/Google Photos/01.06.13/IMG_20130601_110512.jpg tag=takeout-20260107T170725Z-3
2026-01-08 16:44:05 INF server asset upgraded file=takeout-20260107T170725Z-3-001:Takeout/Google Photos/01.06.13/IMG_20130601_110512.jpg
2026-01-08 16:44:05 DBG CacheReader: remove temporary file name=/home/user/.cache/immich-go/temp/immich-go_3542537926
2026-01-08 16:44:05 INF stacked file=takeout-20260107T170725Z-3-001:Takeout/Google Photos/01.06.13/IMG_20130601_110512-edited.jpg
2026-01-08 16:44:05 INF stacked file=takeout-20260107T170725Z-3-001:Takeout/Google Photos/01.06.13/IMG_20130601_110512.jpg
2026-01-08 16:44:05 ERR Can't create stack error=createStack, POST, https://photos.example.com/api/stacks, 500 Internal Server Error
Failed to create stack
immich-server
[Nest] 15 - 01/08/2026, 4:44:05 PM DEBUG [Api:LoggingInterceptor~m89xaeic] POST /api/assets 201 89.51ms 83.65.162.102
[Nest] 15 - 01/08/2026, 4:44:05 PM VERBOSE [Api:LoggingInterceptor~m89xaeic] {"deviceId":"born2chill","assetType":"image","duration":"00:00:00.000000","fileCreatedAt":"2013-06-01T11:05:12.000Z","fileModifiedAt":"2026-01-08T15:44:04.505Z","isFavorite":"false","fileExtension":".jpg","isReadOnly":"false","visibility":"timeline","deviceAssetId":"IMG_20130601_110512.jpg-2686406"}
[Nest] 15 - 01/08/2026, 4:44:05 PM DEBUG [Api:LoggingInterceptor~86dsnf3a] PUT /api/assets/copy 204 97.52ms 83.65.162.102
[Nest] 15 - 01/08/2026, 4:44:05 PM VERBOSE [Api:LoggingInterceptor~86dsnf3a] {"sourceId":"02198321-8d91-4274-abe9-7e2f32651f30","targetId":"8039dc3c-fca0-4127-ad56-f94c67ed2aaa","albums":true,"favorite":true,"sharedLinks":true,"sidecar":true,"stack":true}
[Nest] 15 - 01/08/2026, 4:44:05 PM DEBUG [Api:LoggingInterceptor~5b8lcueu] DELETE /api/assets 204 23.32ms 83.65.162.102
[Nest] 15 - 01/08/2026, 4:44:05 PM VERBOSE [Api:LoggingInterceptor~5b8lcueu] {"force":true,"ids":["02198321-8d91-4274-abe9-7e2f32651f30"]}
[Nest] 2 - 01/08/2026, 4:44:05 PM DEBUG [Microservices:TrashService] Queueing 1 asset(s) for deletion from the trash
[Nest] 2 - 01/08/2026, 4:44:05 PM LOG [Microservices:TrashService] Queued 1 asset(s) for deletion from the trash
Query failed : {
durationMs: 41.499621999995725,
error: PostgresError: insert or update on table "stack" violates foreign key constraint "stack_primaryAssetId_fkey"
at ErrorResponse (/usr/src/app/server/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/cjs/src/connection.js:794:26)
at handle (/usr/src/app/server/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/cjs/src/connection.js:480:6)
at TLSSocket.data (/usr/src/app/server/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/cjs/src/connection.js:315:9)
at TLSSocket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:189:23)
at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '23503',
detail: 'Key (primaryAssetId)=(02198321-8d91-4274-abe9-7e2f32651f30) is not present in table "asset".',
schema_name: 'public',
table_name: 'stack',
constraint_name: 'stack_primaryAssetId_fkey',
file: 'ri_triggers.c',
line: '2599',
routine: 'ri_ReportViolation'
},
sql: 'insert into "stack" ("ownerId", "primaryAssetId") values ($1, $2) returning "id"',
params: [
'7edaf501-e520-45e3-be73-511468d64f33',
'02198321-8d91-4274-abe9-7e2f32651f30'
]
}
[Nest] 15 - 01/08/2026, 4:44:05 PM ERROR [Api:ErrorInterceptor~fhzgy7th] Unknown error: PostgresError: insert or update on table "stack" violates foreign key constraint "stack_primaryAssetId_fkey"
PostgresError: insert or update on table "stack" violates foreign key constraint "stack_primaryAssetId_fkey"
at ErrorResponse (/usr/src/app/server/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/cjs/src/connection.js:794:26)
at handle (/usr/src/app/server/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/cjs/src/connection.js:480:6)
at TLSSocket.data (/usr/src/app/server/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/cjs/src/connection.js:315:9)
at TLSSocket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:189:23)
at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels