semaphoreui/semaphore · error

secret storage does not exist in secret_storage[].name

Error message

secret storage does not exist in secret_storage[].name

What it means

During BackupAccessKey.Restore, if the access key specifies a Storage name, it is resolved against the backup's secret_storages[] by name. When no matching secret storage exists, restore aborts with this error so no access key is created pointing at a missing storage backend.

Solutions

  1. Add a secret_storage entry with the exact missing name to the backup.
  2. Change the key's storage reference to an existing secret_storage[].name.
  3. Remove the storage reference (set to null) if the key does not need it.
  4. Re-export a full backup that includes secret storages and access keys together.

Example fix

// before
"storage": "vault-prod", "secret_storage": []
// after
"secret_storage": [{"name": "vault-prod", ...}]
Defensive patterns

Strategy: validation

Validate before calling

func accessKeyStorageExists(b BackupFormat) error {
    for _, k := range b.AccessKeys {
        if k.Storage != nil && getEntryByName[BackupSecretStorage](*k.Storage, b.SecretStorages) == nil {
            return fmt.Errorf("key %q references missing storage %q", k.Name, *k.Storage)
        }
    }
    return nil
}

Try / catch

if err := backup.Verify(); err != nil {
    if strings.Contains(err.Error(), "secret storage does not exist") {
        // add the storage or null the reference, then retry
    }
    return err
}

Prevention

When it happens

Trigger: Restoring a backup where an access key's storage name is not found in secret_storage[].name — secret storage was deleted/renamed, omitted from export, or the backup JSON was edited.

Common situations: Backups taken after a secret storage was removed; environment migration (staging names in a prod restore); partial backups that excluded secret storages; typo in the storage name.

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/3a6855f006316689. Report an issue: GitHub.

Appendix: source

Thrown at services/project/restore.go:147

	}

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

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

func (e BackupAccessKey) Restore(b *BackupDB) error {

	key := e.AccessKey
	key.ProjectID = &b.meta.ID

	if e.Storage != nil {
		storage := findEntityByName[db.SecretStorage](e.Storage, b.secretStorages)
		if storage == nil {
			return fmt.Errorf("secret storage does not exist in secret_storage[].name")
		}
		key.StorageID = &storage.ID
	}

	if e.SourceStorage != nil {
		sourceStorage := findEntityByName[db.SecretStorage](e.SourceStorage, b.secretStorages)
		if sourceStorage == nil {
			return fmt.Errorf("secret storage does not exist in secret_storage[].name")
		}
		key.SourceStorageID = &sourceStorage.ID
	}

	newKey, err := b.store.CreateAccessKey(key)

	if err != nil {
		return err
	}
	b.keys = append(b.keys, newKey)

View on GitHub (pinned to 1774ccb71a)