grafana/k6 · error

no secret sources are configured

Error message

no secret sources are configured

What it means

Returned by the secret source Manager.Get when a secret is requested but no secret sources were registered at startup — the internal cache map is empty, so there is no provider to query for the given source name and key.

Solutions

  1. Register at least one secret source (e.g. via a secret source extension) before the test run
  2. Verify the k6 build includes the required secret source extension
  3. Do not reference ${{secret:...}} placeholders if no sources are configured
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at secretsource/manager.go:58 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@8d06114777 (2026-08-18). Data as JSON: /api/errors/b6a7f50386d1dc49. Report an issue: GitHub.

Appendix: source

Thrown at secretsource/manager.go:58

			cache[k] = cache["default"]
			continue
		}
		cache[k] = new(sync.Map)
	}
	sm := &Manager{
		hook:    hook,
		sources: sources,
		cache:   cache,
	}
	return sm, hook, nil
}

// Get is the way to get a secret for the provided source name and key of the secret.
// It can be used with the [DefaultSourceName].
// This automatically starts redacting the secret before returning it.
func (sm *Manager) Get(sourceName, key string) (string, error) {
	if len(sm.cache) == 0 {
		return "", errors.New("no secret sources are configured")
	}
	sourceCache, ok := sm.cache[sourceName]
	if !ok {
		return "", UnknownSourceError(sourceName)
	}
	v, ok := sourceCache.Load(key)
	if ok {
		return v.(string), nil //nolint:forcetypeassert
	}
	source := sm.sources[sourceName]
	value, err := source.Get(key)
	if err != nil {
		return "", err
	}
	sourceCache.Store(key, value)
	sm.hook.add(value)
	return value, err
}

View on GitHub (pinned to 8d06114777)