grafana/k6 · error

unknown configuration key for file secret source %q

Error message

unknown configuration key for file secret source %q

What it means

fileSecretSource.parseArg treats a comma-separated item without '=' as the filename, and items with '=' must use the key "filename". Any other key reaches this error, meaning an unsupported option was passed to the file secret source config, so the source is rejected at registration.

Source

Thrown at internal/secretsource/file/file.go:54

		}
		return fss, nil
	})
}

func (fss *fileSecretSource) parseArg(config string) error {
	list := strings.Split(config, ",")
	if len(list) >= 1 {
		for _, kv := range list {
			k, v, ok := strings.Cut(kv, "=")
			if !ok {
				fss.filename = kv
				continue
			}
			switch k {
			case "filename":
				fss.filename = v
			default:
				return fmt.Errorf("unknown configuration key for file secret source %q", k)
			}
		}
	}
	return nil
}

type fileSecretSource struct {
	internal map[string]string
	filename string
}

func (fss *fileSecretSource) Description() string {
	return fmt.Sprintf("file source from %s", fss.filename)
}

func (fss *fileSecretSource) Get(key string) (string, error) {
	v, ok := fss.internal[key]
	if !ok {

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Use only filename=<path> in the file secret source argument, e.g. --secret-source file=filename=./secrets.env
  2. Pass a bare path without '=' to use it as the filename
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/secretsource/file/file.go:54 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/44f62b3f46930df2. Report an issue: GitHub.