semaphoreui/semaphore · error

error at views[ ]

Error message

error at views[%d]: %s

What it means

BackupFormat.Verify() validates each entry in backup.Views by calling BackupView.Verify and wraps any failure with the view's index. This error tells the caller that the view at views[i] failed validation (e.g. duplicate names or broken references inside the view).

Solutions

  1. Read the wrapped inner message to identify the failing view's specific problem
  2. Rename or remove the duplicate views[i].name so view names are unique in the backup
  3. Fix any entity reference inside the view to point at an existing backup entry
  4. Re-export the backup after fixing so Verify() passes cleanly

Example fix

// before
{"views": [{"name": "dashboard"}, {"name": "dashboard"}]}
// after
{"views": [{"name": "dashboard"}, {"name": "dashboard-2"}]}
Defensive patterns

Strategy: try-catch

Validate before calling

if err := backup.Verify(); err != nil {
    var idx int
    if n, _ := fmt.Sscanf(err.Error(), "error at views[%d]", &idx); n == 1 {
        log.Printf("view entry %d is invalid", idx)
    }
    return err
}

Try / catch

if err := backup.Verify(); err != nil {
    if strings.HasPrefix(err.Error(), "error at views[") {
        // parse index and inner message; deduplicate or fix backup.Views[i]
        return fmt.Errorf("invalid backup: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling BackupFormat.Verify() when the view at index i fails verification — typically a duplicate views[].name (via verifyDuplicate) or a reference inside the view to a non-existent entity.

Common situations: Backup files with duplicated view names after merging; views copied between projects keeping stale references; generated backups that did not deduplicate view names.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at services/project/restore.go:543

	newWorkflow, err := b.workflowStore.CreateWorkflowTemplate(workflow)
	if err != nil {
		return err
	}

	b.workflows = append(b.workflows, newWorkflow)
	return nil
}

func (backup *BackupFormat) Verify() error {
	for i, o := range backup.Environments {
		if err := o.Verify(backup); err != nil {
			return fmt.Errorf("error at environments[%d]: %s", i, err.Error())
		}
	}
	for i, o := range backup.Views {
		if err := o.Verify(backup); err != nil {
			return fmt.Errorf("error at views[%d]: %s", i, err.Error())
		}
	}
	for i, o := range backup.Schedules {
		if err := o.Verify(backup); err != nil {
			return fmt.Errorf("error at templates[%d]: %s", i, err.Error())
		}
	}
	for i, o := range backup.Keys {
		if err := o.Verify(backup); err != nil {
			return fmt.Errorf("error at keys[%d]: %s", i, err.Error())
		}
	}
	for i, o := range backup.Repositories {
		if err := o.Verify(backup); err != nil {
			return fmt.Errorf("error at repositories[%d]: %s", i, err.Error())
		}
	}
	for i, o := range backup.Inventories {

View on GitHub (pinned to 1774ccb71a)