semaphoreui/semaphore · error

item does not exist

Error message

item %d does not exist

What it means

findNameByID in services/project/backup.go:29 scans the given entity list comparing each GetID() to the requested numeric ID and returns "item %d does not exist" when nothing matches. It is used during backup formatting to resolve entity IDs from a backup file to names.

Solutions

  1. Look up which entity type and ID the backup references and confirm it exists in the target database (SELECT by id).
  2. Recreate the missing entity so its ID matches, or update the backup file to point at an existing ID.
  3. Re-export the backup with all referenced entities included.
  4. If IDs cannot match across instances, restore into the original instance or edit references to use names/slugs instead of IDs.

Example fix

// before
"template_id": 42  // no template with ID 42 in target DB
// after
"template_id": 17  // ID of an existing template in the target DB
Defensive patterns

Strategy: validation

Validate before calling

ids := map[int]bool{}
for _, it := range items { ids[it.GetID()] = true }
if !ids[id] { return fmt.Errorf("backup references missing entity ID %d", id) }

Prevention

When it happens

Trigger: format() processes a backup that references an entity by numeric ID (e.g. schedule template ID, repository ID) that is absent from the supplied list of that entity type in the database.

Common situations: Restoring a backup taken from another instance where auto-increment IDs differ; referencing an entity that was deleted after the backup was made; backup produced with a database dump of only part of the project's entities.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at services/project/backup.go:29

func findNameBySlug[T db.BackupSluggedEntity](slug string, items []T) (*string, error) {
	for _, o := range items {
		if o.GetSlug() == slug {
			name := o.GetName()
			return &name, nil
		}
	}
	return nil, fmt.Errorf("item %s does not exist", slug)
}

func findNameByID[T db.BackupEntity](ID int, items []T) (*string, error) {
	for _, o := range items {
		if o.GetID() == ID {
			name := o.GetName()
			return &name, nil
		}
	}
	return nil, fmt.Errorf("item %d does not exist", ID)
}

func findEntityByName[T db.BackupEntity](name *string, items []T) *T {
	if name == nil {
		return nil
	}
	for _, o := range items {
		if o.GetName() == *name {
			return &o
		}
	}
	return nil
}

func getSchedulesByProject(projectID int, schedules []db.Schedule) []db.Schedule {
	result := make([]db.Schedule, 0)
	for _, o := range schedules {
		if o.ProjectID == projectID {

View on GitHub (pinned to 1774ccb71a)