[GH-ISSUE #1124] [Issue]: Profile import fails on Docker/file storage when app_settings.ui already exists #557

Closed
opened 2026-10-20 17:30:09 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Xelvanis on GitHub (May 23, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1124

Originally assigned to: @cha1latte on GitHub.

Summary

A user migrating from a local Windows install to a Docker container on Unraid reports that full profile import fails with a duplicate primary key error for synced UI settings.

The same exported file also produces a confusing secondary error if selected through the generic Marinara File importer instead of Import Profile.

Expected behavior

A full marinara_profile export from one Marinara install should import into a fresh Docker/file-storage install without failing because the target instance has already seeded default synced UI settings.

If a full profile export is selected in the generic Marinara File importer, the UI should direct the user to Import Profile instead of surfacing a low-level unknown export type message.

Actual behavior

Import Profile fails with:

[file-storage] Duplicate primary key for app_settings.key: ui

Trying the same export through the Marinara File importer fails with:

Import failed: Unknown export type: marinara_profile

Steps to reproduce

  1. Run Marinara locally on Windows and export a full profile.
  2. Start Marinara in a Docker container on Unraid.
  3. Open the new Docker instance so the client/server can create the default synced UI settings row.
  4. Use Settings -> Import -> Import Profile and select the exported profile JSON/ZIP.
  5. Observe the duplicate primary key error for app_settings.key: ui.
  6. Optionally select the same full profile export through the generic Marinara File importer and observe Unknown export type: marinara_profile.

Environment

  • Marinara Engine version: not provided by reporter
  • Install type: Windows local/source export -> Docker container import
  • OS + version: Windows version not provided; Unraid version not provided
  • Browser or app shell: browser, exact browser not provided

Logs, screenshots, or video

Reporter-provided error text:

[file-storage] Duplicate primary key for app_settings.key: ui
Import failed: Unknown export type: marinara_profile

Screenshot was provided in the support report, but no uploadable attachment/URL is available for this issue.

Additional context

Code trace suggests the full profile snapshot importer only enables conflict handling for tables with an id column:

  • packages/server/src/routes/backup.routes.ts uses (table as Record<string, unknown>).id as the upsert target during profile snapshot import.
  • packages/server/src/db/schema/app-settings.ts defines app_settings.key as the primary key.
  • packages/client/src/hooks/use-settings-sync.ts uses the synced settings key ui and seeds it on first run when the server has no settings value yet.

So the likely failure path is:

  1. Docker/file-storage instance starts empty.
  2. Client settings sync seeds app_settings with key = "ui".
  3. Profile import reaches the app_settings table in data.fileStorage.tables.
  4. Importer does plain insert instead of upsert because the table has no id property.
  5. File-native storage reports duplicate primary key for app_settings.key: ui.

Possible fix direction: resolve the real primary key/conflict target for profile snapshot tables instead of assuming id, at minimum covering key-based tables such as app_settings and prompt_overrides.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Xelvanis on GitHub (May 23, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1124 Originally assigned to: @cha1latte on GitHub. ## Summary A user migrating from a local Windows install to a Docker container on Unraid reports that full profile import fails with a duplicate primary key error for synced UI settings. The same exported file also produces a confusing secondary error if selected through the generic Marinara File importer instead of Import Profile. ## Expected behavior A full `marinara_profile` export from one Marinara install should import into a fresh Docker/file-storage install without failing because the target instance has already seeded default synced UI settings. If a full profile export is selected in the generic Marinara File importer, the UI should direct the user to Import Profile instead of surfacing a low-level unknown export type message. ## Actual behavior Import Profile fails with: ```text [file-storage] Duplicate primary key for app_settings.key: ui ``` Trying the same export through the Marinara File importer fails with: ```text Import failed: Unknown export type: marinara_profile ``` ## Steps to reproduce 1. Run Marinara locally on Windows and export a full profile. 2. Start Marinara in a Docker container on Unraid. 3. Open the new Docker instance so the client/server can create the default synced UI settings row. 4. Use Settings -> Import -> Import Profile and select the exported profile JSON/ZIP. 5. Observe the duplicate primary key error for `app_settings.key: ui`. 6. Optionally select the same full profile export through the generic Marinara File importer and observe `Unknown export type: marinara_profile`. ## Environment - Marinara Engine version: not provided by reporter - Install type: Windows local/source export -> Docker container import - OS + version: Windows version not provided; Unraid version not provided - Browser or app shell: browser, exact browser not provided ## Logs, screenshots, or video Reporter-provided error text: ```text [file-storage] Duplicate primary key for app_settings.key: ui ``` ```text Import failed: Unknown export type: marinara_profile ``` Screenshot was provided in the support report, but no uploadable attachment/URL is available for this issue. ## Additional context Code trace suggests the full profile snapshot importer only enables conflict handling for tables with an `id` column: - `packages/server/src/routes/backup.routes.ts` uses `(table as Record<string, unknown>).id` as the upsert target during profile snapshot import. - `packages/server/src/db/schema/app-settings.ts` defines `app_settings.key` as the primary key. - `packages/client/src/hooks/use-settings-sync.ts` uses the synced settings key `ui` and seeds it on first run when the server has no settings value yet. So the likely failure path is: 1. Docker/file-storage instance starts empty. 2. Client settings sync seeds `app_settings` with `key = "ui"`. 3. Profile import reaches the `app_settings` table in `data.fileStorage.tables`. 4. Importer does plain insert instead of upsert because the table has no `id` property. 5. File-native storage reports duplicate primary key for `app_settings.key: ui`. Possible fix direction: resolve the real primary key/conflict target for profile snapshot tables instead of assuming `id`, at minimum covering key-based tables such as `app_settings` and `prompt_overrides`. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:30:09 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@cha1latte commented on GitHub (May 24, 2026):

Fixed in refactor via #1177.

<!-- gh-comment-id:4529882899 --> @cha1latte commented on GitHub (May 24, 2026): Fixed in refactor via #1177.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#557
No description provided.