semaphoreui/semaphore · error
repository does not exist in repositories[].name
Error message
repository does not exist in repositories[].name
What it means
Thrown by BackupTemplate.Verify when the template's inline repository reference (e.Repository) is not found by name in backup.Repositories. Templates reference a repository by name, and this check guarantees the referenced repository exists before restore proceeds.
Solutions
- Add the missing repository to backup.Repositories with the exact name the template references.
- Update the template's repository field to an existing repositories[].name.
- Delete the template from the backup if it is no longer needed.
Example fix
// before
"templates": [{"name": "build", "repository": "app-repo"}], "repositories": []
// after
"templates": [{"name": "build", "repository": "app-repo"}], "repositories": [{"name": "app-repo"}] Defensive patterns
Strategy: validation
Validate before calling
for _, t := range backup.Templates {
if !repoNameExists(t.Repository.Name, backup.Repositories) {
return fmt.Errorf("template %q references missing repository %q", t.Name, t.Repository.Name)
}
} Type guard
func repoNameExists(name string, repos []BackupRepository) bool {
for _, r := range repos {
if r.Name == name { return true }
}
return false
} Try / catch
if err := tmpl.Verify(backup); err != nil {
if strings.Contains(err.Error(), "repository does not exist") {
// add the repository or fix the reference, then retry
}
} Prevention
- Export templates and their repositories in the same backup scope.
- Run whole-backup Verify before restore.
- Keep repository names stable across backup/restore cycles.
When it happens
Trigger: Verify on a BackupFormat whose templates[] entry points at a repositories[] name that does not exist — repository omitted from the export, renamed, or typo in the template's repository field.
Common situations: Migrating a single template without its repository; renaming a repository after backup; hand-merging backups from two projects; export filters that dropped repositories but kept templates.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- deploy is build but build_template does not exist in…
- inventory does not exist in inventories[].name
- vault_key does not exist in keys[].name
- vaults[].vaultKey does not exist in keys[].name
- view does not exist in views[].name
AI-assisted analysis of semaphoreui/semaphore@1774ccb71a (2026-09-07).
Data as JSON: /api/errors/7373c3d308d2343d.
Report an issue: GitHub.
Appendix: source
Thrown at services/project/restore.go:249
repo := e.Repository
repo.ProjectID = b.meta.ID
repo.SSHKeyID = SSHKeyID
newRepo, err := b.store.CreateRepository(repo)
if err != nil {
return err
}
b.repositories = append(b.repositories, newRepo)
return nil
}
func (e BackupTemplate) Verify(backup *BackupFormat) error {
if err := verifyDuplicate[BackupTemplate](e.Name, backup.Templates); err != nil {
return err
}
if getEntryByName[BackupRepository](&e.Repository, backup.Repositories) == nil {
return fmt.Errorf("repository does not exist in repositories[].name")
}
if e.Inventory != nil && getEntryByName[BackupInventory](e.Inventory, backup.Inventories) == nil {
return fmt.Errorf("inventory does not exist in inventories[].name")
}
if e.VaultKey != nil && getEntryByName[BackupAccessKey](e.VaultKey, backup.Keys) == nil {
return fmt.Errorf("vault_key does not exist in keys[].name")
}
if e.Vaults != nil {
for _, vault := range e.Vaults {
if vault.VaultKey != nil {
if getEntryByName[BackupAccessKey](vault.VaultKey, backup.Keys) == nil {
return fmt.Errorf("vaults[].vaultKey does not exist in keys[].name")
}
}
}View on GitHub (pinned to 1774ccb71a)