Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 4, 2025

When a template vault references a deleted access key, GetTemplates fails with 404, causing the frontend to hang in infinite loading state. Users encounter this after deleting vault passwords that templates still reference.

Changes

  • db/TemplateVault.go: Modified FillTemplateVault to catch ErrNotFound when fetching missing access keys

    • Returns successfully with nil vault instead of propagating error
    • Logs warning with vault/key/project IDs for troubleshooting
    • Other errors still propagate normally
  • db/bolt/template_vault_test.go: Added TestGetTemplateVaults_WithMissingAccessKey to verify templates load with orphaned vault references

Behavior

Before:

vault, err := d.GetAccessKey(projectID, *templateVault.VaultKeyID)
if err != nil {
    return  // Fails entire GetTemplates request
}

After:

vault, err := d.GetAccessKey(projectID, *templateVault.VaultKeyID)
if err != nil {
    if errors.Is(err, ErrNotFound) {
        log.Warn("Template vault references non-existent access key")
        return nil  // Continue loading templates
    }
    return  // Propagate other errors
}

Templates now load successfully even when vault keys have been deleted, with templateVault.Vault remaining nil for missing keys.

Original prompt

This section details on the original issue you should resolve

<issue_title>Problem: Templates screen stuck in loading</issue_title>
<issue_description>### Issue

The templates screen was stuck in loading.
Also when I opened the templates via the dashboard (direct link) and hit the edit button it got stuck.

It seems the issue was that i created a vault password (which didn't seem to work) but moved on to variable groups with a secret. When I added the VG the templates screen did not get out of the loading loop anymore.

I have deleted the vault entries from the sqlite database:
delete from project__template_vault;

After this the templates screen is showing and I can edit my templates again.

Other info:
Version: v2.16.32-d2c2b4a-1760089605
Sqlite database (not BoltDB)

Impact

Web-Frontend (what users interact with)

Installation method

Docker

Database

BoltDB

Browser

Chrome

Semaphore Version

v2.16.32-d2c2b4a-1760089605

Ansible Version

ansible 2.10.8

Logs & errors

Nothing was being logged.
I only got a 404 in the development view of my browser.

Manual installation - system information

No response

Configuration

No response

Additional information

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits November 4, 2025 21:18
- Modified FillTemplateVault to gracefully handle missing access keys
- Added error checking for ErrNotFound and log warning instead of failing
- Added test case to verify templates load correctly with missing vault keys
- Prevents entire template list from failing when one vault references deleted key

Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
- Document the function's behavior when vault keys are missing
- Clarify that Vault field remains nil when key is not found
- Explain error handling and logging approach

Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix templates screen getting stuck in loading state Fix templates screen loading failure when vault references deleted access key Nov 4, 2025
Copilot AI requested a review from fiftin November 4, 2025 21:28
Copilot finished work on behalf of fiftin November 4, 2025 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem: Templates screen stuck in loading

2 participants