Skip to content

Cloning an app with a custom data source fails with 422 (idx_unique_active_name_branch violation) #17679

Description

@Siddharthpl

POST /api/v2/resources/clone renames the cloned app but not its data source(s) (ImportExportResourcesService.clone, server/src/modules/import-export-resources/service.ts:160). When the app has a custom data source, the clone tries to insert an active data_source_versions row with the same name on the same branch as the still-existing original — violating idx_unique_active_name_branch (422, Postgres 23505).

Repro: Create an app with a custom data source, clone it in the same workspace → 422.

Fix: Rename/dedupe the cloned data source's name (like the app name already is) before import.

Related: Quarantined test should be able to clone the app if user is a super admin in apps.spec.ts (QUARANTINE(apps), blocked on #17258). DoD: fix + test un-skipped and green in run-ci.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions