grafana/k6 · error

unknown configuration key: %q

Error message

unknown configuration key: %q

What it means

parseInlineConfigOption hit parseHeaderOption for an unrecognized key that also lacks the required headers. prefix; it is a generic guard rejecting any configuration key that is neither known nor a custom header definition.

Source

Thrown at internal/secretsource/url/url.go:405

	if err != nil {
		return fmt.Errorf("invalid %s: %w", optionName, err)
	}
	*target = null.IntFrom(intValue)
	return nil
}

func parseDurationOption(value string, target *types.NullDuration, optionName string) error {
	duration, err := time.ParseDuration(value)
	if err != nil {
		return fmt.Errorf("invalid %s: %w", optionName, err)
	}
	*target = types.NullDurationFrom(duration)
	return nil
}

func parseHeaderOption(key, value string, cfg *extConfig) error {
	if !strings.HasPrefix(key, "headers.") {
		return fmt.Errorf("unknown configuration key: %q", key)
	}

	headerName := strings.TrimPrefix(key, "headers.")
	if cfg.Headers == nil {
		cfg.Headers = make(map[string]string)
	}
	cfg.Headers[headerName] = value
	return nil
}

// parseEnvConfig reads configuration from environment variables.
// It looks for variables with the prefix K6_SECRET_SOURCE_URL_.
// Example environment variables:
//   - K6_SECRET_SOURCE_URL_URL_TEMPLATE
//   - K6_SECRET_SOURCE_URL_HEADER_AUTHORIZATION
//   - K6_SECRET_SOURCE_URL_METHOD
//   - K6_SECRET_SOURCE_URL_RESPONSE_PATH
//   - K6_SECRET_SOURCE_URL_TIMEOUT

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Fix the misspelled key or remove it
  2. Use headers.<name>=<value> for custom headers on secret requests
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/secretsource/url/url.go:405 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/0ecd16837049ac09. Report an issue: GitHub.