semaphoreui/semaphore · error

repo does not exist in repositories[].name

Error message

repo does not exist in repositories[].name

What it means

BackupSchedule.Restore resolves the optional CheckableRepository reference by name against the backup's repositories[] array. If the named repository is absent, restore returns this error instead of creating a schedule with a dangling repository ID.

Solutions

  1. Add the repository with that name to repositories[] in the backup.
  2. Point check_repository at an existing repositories[].name entry.
  3. Set check_repository to null if the schedule does not need a checkable repository.
  4. Re-export a complete backup containing both repositories and schedules.

Example fix

// before
"check_repository": "legacy-repo", "repositories": []
// after
"check_repository": "main-repo"  // exists in repositories[]
Defensive patterns

Strategy: validation

Validate before calling

func scheduleRepoExists(b BackupFormat) error {
    for _, s := range b.Schedules {
        if s.CheckableRepository != nil && getEntryByName[BackupRepository](*s.CheckableRepository, b.Repositories) == nil {
            return fmt.Errorf("schedule references missing repository %q", *s.CheckableRepository)
        }
    }
    return nil
}

Try / catch

if err := backup.Verify(); err != nil {
    if strings.Contains(err.Error(), "repo does not exist") {
        // add the repository or clear check_repository, then retry
    }
    return err
}

Prevention

When it happens

Trigger: Restoring a backup where schedule.check_repository names a repository not present in repositories[].name — deleted/renamed repo at source, partial export, or manual edits.

Common situations: Repository deleted before the backup was taken while schedules still referenced it; backups assembled from multiple projects; renamed repositories without updating schedules.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of semaphoreui/semaphore@1774ccb71a (2026-09-07). Data as JSON: /api/errors/931d8ae9324230ab. Report an issue: GitHub.

Appendix: source

Thrown at services/project/restore.go:114

func (e BackupSchedule) Verify(backup *BackupFormat) error {
	return verifyDuplicate[BackupSchedule](e.Name, backup.Schedules)
}

func (e BackupSchedule) Restore(b *BackupDB) error {
	v := e.Schedule
	v.ProjectID = b.meta.ID

	tpl := findEntityByName[db.Template](&e.Template, b.templates)
	if tpl == nil {
		return fmt.Errorf("template does not exist in templates[].name")
	}
	v.TemplateID = tpl.ID

	if e.CheckableRepository != nil {
		repo := findEntityByName[db.Repository](e.CheckableRepository, b.repositories)
		if repo == nil {
			return fmt.Errorf("repo does not exist in repositories[].name")
		}
		v.RepositoryID = &repo.ID
	}

	if e.TaskParams != nil {
		inv := findEntityByName[db.Inventory](e.TaskParams.InventoryName, b.inventories)
		if inv != nil {
			v.TaskParams.InventoryID = &inv.ID
		}
	}

	newSchedule, err := b.store.CreateSchedule(v)
	if err != nil {
		return err
	}

	b.schedules = append(b.schedules, newSchedule)
	return nil

View on GitHub (pinned to 1774ccb71a)