{"record":{"id":"021f361460448201","repo":"semaphoreui/semaphore","slug":"error-at-workflows-d-s","errorCode":null,"errorMessage":"error at workflows[%d]: %s","messagePattern":"error at workflows\\[(.+?)\\]: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"services/project/restore.go","lineNumber":588,"sourceCode":"\t}\n\tfor i, o := range backup.Templates {\n\t\tif err := o.Verify(backup); err != nil {\n\t\t\treturn fmt.Errorf(\"error at templates[%d]: %s\", i, err.Error())\n\t\t}\n\t}\n\tfor i, o := range backup.Roles {\n\t\tif err := o.Verify(backup); err != nil {\n\t\t\treturn fmt.Errorf(\"error at roles[%d]: %s\", i, err.Error())\n\t\t}\n\t}\n\tfor i, o := range backup.Runners {\n\t\tif err := o.Verify(backup); err != nil {\n\t\t\treturn fmt.Errorf(\"error at runners[%d]: %s\", i, err.Error())\n\t\t}\n\t}\n\tfor i, o := range backup.Workflows {\n\t\tif err := o.Verify(backup); err != nil {\n\t\t\treturn fmt.Errorf(\"error at workflows[%d]: %s\", i, err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (backup *BackupFormat) Restore(user db.User, store db.Store, workflowStore db.WorkflowManager) (*db.Project, error) {\n\tvar b = BackupDB{store: store, workflowStore: workflowStore}\n\tproject := backup.Meta.Project\n\n\t// Prevent importing a project with a name that already exists\n\texistingProjects, err := b.store.GetAllProjects()\n\tif err == nil {\n\t\tfor _, p := range existingProjects {\n\t\t\tif p.Name == project.Name { // exact name match\n\t\t\t\treturn nil, common_errors.NewValidationError(fmt.Sprintf(\"project with name '%s' already exists\", project.Name))\n\t\t\t}\n\t\t}","sourceCodeStart":570,"sourceCodeEnd":606,"githubUrl":"https://github.com/semaphoreui/semaphore/blob/1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa/services/project/restore.go#L570-L606","documentation":"This error wraps a per-item failure from BackupFormat.Verify() while validating backup.Workflows: the workflow at index i failed o.Verify(backup). A workflow entry in the backup is invalid — commonly nodes/edges referencing templates, inventories, or other nodes not present in the backup — so the whole backup fails validation before restore begins.","triggerScenarios":"Calling BackupFormat.Verify() where the workflow at backup.Workflows[i] fails Verify — e.g. missing workflow name, node referencing a template absent from backup.Templates, or malformed edges.","commonSituations":"Backups whose workflow graphs reference entities that were hand-removed; version drift between exporting and importing Semaphore instances; truncated or concatenated backup files.","solutions":["Read the inner error after 'workflows[i]:' to identify the failing node or field","Fix the workflow entry at that index, ensuring all referenced templates/inventories exist in the backup","Validate the backup JSON structure (nodes/edges/name) before calling Verify again","Re-export a fresh backup from the source instance rather than editing the workflow graph by hand"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for i, w := range backup.Workflows {\n    if w == nil || w.Name == \"\" || len(w.Nodes) == 0 {\n        return fmt.Errorf(\"workflows[%d]: invalid workflow before restore\", i)\n    }\n}\nif err := backup.Verify(); err != nil {\n    return err\n}","typeGuard":"func validWorkflow(w *WorkflowBackup) bool { return w != nil && w.Name != \"\" && len(w.Nodes) > 0 }","tryCatchPattern":"if err := backup.Verify(); err != nil {\n    if strings.Contains(err.Error(), \"workflows[\") {\n        // locate the failing workflow and its node reference\n    }\n    return err\n}","preventionTips":["Ensure workflow nodes only reference entities present in the same backup","Run Verify() before Restore","Never manually remove entities a workflow depends on"],"tags":["backup","validation","workflows","restore"],"backgroundTag":"schema-validation-failed","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"}