{"record":{"id":"931d8ae9324230ab","repo":"semaphoreui/semaphore","slug":"repo-does-not-exist-in-repositories-name","errorCode":null,"errorMessage":"repo does not exist in repositories[].name","messagePattern":"repo does not exist in repositories\\[\\]\\.name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"services/project/restore.go","lineNumber":114,"sourceCode":"\nfunc (e BackupSchedule) Verify(backup *BackupFormat) error {\n\treturn verifyDuplicate[BackupSchedule](e.Name, backup.Schedules)\n}\n\nfunc (e BackupSchedule) Restore(b *BackupDB) error {\n\tv := e.Schedule\n\tv.ProjectID = b.meta.ID\n\n\ttpl := findEntityByName[db.Template](&e.Template, b.templates)\n\tif tpl == nil {\n\t\treturn fmt.Errorf(\"template does not exist in templates[].name\")\n\t}\n\tv.TemplateID = tpl.ID\n\n\tif e.CheckableRepository != nil {\n\t\trepo := findEntityByName[db.Repository](e.CheckableRepository, b.repositories)\n\t\tif repo == nil {\n\t\t\treturn fmt.Errorf(\"repo does not exist in repositories[].name\")\n\t\t}\n\t\tv.RepositoryID = &repo.ID\n\t}\n\n\tif e.TaskParams != nil {\n\t\tinv := findEntityByName[db.Inventory](e.TaskParams.InventoryName, b.inventories)\n\t\tif inv != nil {\n\t\t\tv.TaskParams.InventoryID = &inv.ID\n\t\t}\n\t}\n\n\tnewSchedule, err := b.store.CreateSchedule(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tb.schedules = append(b.schedules, newSchedule)\n\treturn nil","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/semaphoreui/semaphore/blob/1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa/services/project/restore.go#L96-L132","documentation":"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.","triggerScenarios":"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.","commonSituations":"Repository deleted before the backup was taken while schedules still referenced it; backups assembled from multiple projects; renamed repositories without updating schedules.","solutions":["Add the repository with that name to repositories[] in the backup.","Point check_repository at an existing repositories[].name entry.","Set check_repository to null if the schedule does not need a checkable repository.","Re-export a complete backup containing both repositories and schedules."],"exampleFix":"// before\n\"check_repository\": \"legacy-repo\", \"repositories\": []\n// after\n\"check_repository\": \"main-repo\"  // exists in repositories[]","handlingStrategy":"validation","validationCode":"func scheduleRepoExists(b BackupFormat) error {\n    for _, s := range b.Schedules {\n        if s.CheckableRepository != nil && getEntryByName[BackupRepository](*s.CheckableRepository, b.Repositories) == nil {\n            return fmt.Errorf(\"schedule references missing repository %q\", *s.CheckableRepository)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := backup.Verify(); err != nil {\n    if strings.Contains(err.Error(), \"repo does not exist\") {\n        // add the repository or clear check_repository, then retry\n    }\n    return err\n}","preventionTips":["Delete or update schedules when removing repositories.","Include repositories[] in every export that contains schedules.","Verify backups before restore; fail fast on dangling references."],"tags":["backup-restore","referential-integrity","missing-reference"],"backgroundTag":"resource-not-found","analyzedSha":"1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa","analyzedAt":"2026-09-07T11:00:33.293Z","contentChangedAt":"2026-09-07T11:00:33.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}