Skip to content

Problem: Unable to Update an Ansible Project Template when there are existing Vaults #3413

@nima-1278

Description

@nima-1278

Issue

When trying to Update an existing Ansible Project Template:

HTTP PUT http://{{host}}:{{port}}/api/project/{{Project-id}}/templates/{{Template-id}}/

{
   ....
    "vaults": [
        {
            "name": "TEST",
            "type": "password",
            "vault_key_id": 7
        }
    ]
}

If the template already has a vault with the same template_id, vault_key_id, name which are basically the unique constraint in the table project__template_vault

400 Bad Request http error is generated.

Impact

Web-Backend (APIs)

Installation method

Package

Database

Postgres

Browser

Chrome

Semaphore Version

2.16.37

Ansible Version

2.16.4

Logs & errors

time="2025-11-06T19:52:49Z" level=error msg="pq: duplicate key value violates unique constraint \"project__template_vault_template_id_vault_key_id_name_key\""

Manual installation - system information

Photon 5

Configuration

NA

Additional information

Trying to Update an existing Ansible Project Template with the same vault should not raise an error.

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions