semaphoreui/semaphore · error

values not loaded

Error message

values not loaded

What it means

ValueMap.getLoadedKeys requires the entity values to have been loaded from the store beforehand; if the internal values slice is still nil, the exporter was used before its load phase. The error prevents computing keys from non-existent data.

Solutions

  1. Ensure exporter.load(store, chain, progress) runs for every type before any getLoadedKeys call on it
  2. Check for and handle earlier load errors that left the ValueMap uninitialized
  3. If writing custom exporter code, call the load step explicitly before resolving keys

Example fix

// before
keys, err := valueMap.getLoadedKeys(scope) // 'values not loaded'
// after
if err := valueMap.load(store, chain, progress); err != nil {
    return err
}
keys, err := valueMap.getLoadedKeys(scope)
Defensive patterns

Strategy: try-catch

Validate before calling

if valueMap.values == nil {
    return errors.New("load values before reading keys")
}

Try / catch

keys, err := valueMap.getLoadedKeys(scope)
if err != nil && err.Error() == "values not loaded" {
    if lerr := valueMap.load(store, chain, progress); lerr != nil {
        return lerr
    }
    keys, err = valueMap.getLoadedKeys(scope)
}
if err != nil { return err }

Prevention

When it happens

Trigger: Calling getLoadedKeys (via getLoadedKeysInt) on a ValueMap whose load() was never invoked — e.g. the export/import chain asks for loaded keys of a type before running that type's loader, or loading was skipped due to an earlier failure.

Common situations: Customizing the export chain and calling getLoadedKeys out of order; an earlier load error left the exporter uninitialized while dependent exporters still query it.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

Thrown at services/export/Exporter.go:206

}

type ValueExporter[T EntityType] interface {
	restoreValue(val EntityObject[T], store db.Store, exporter DataExporter) (err error)

	getName() string
}

type ValueMap[T EntityType] struct {
	values      []EntityObject[T]
	keyScopeMap map[string]bool
	errs        []string
	uniqueKeys  bool
}

func (t *ValueMap[T]) getLoadedKeys(scope string) ([]EntityKey, error) {

	if t.values == nil {
		return nil, fmt.Errorf("values not loaded")
	}

	keys := make([]EntityKey, 0, len(t.values))
	for _, v := range t.values {
		if v.scope == scope {
			keys = append(keys, v.value.GetDbKey())
		}
	}

	return keys, nil
}

func (t *ValueMap[T]) getLoadedKeysInt(scope string) ([]int, error) {
	keys, err := t.getLoadedKeys(scope)
	if err != nil {
		return nil, err
	}
	keysInt := make([]int, 0)

View on GitHub (pinned to 1774ccb71a)