grafana/k6 · error

%q is an unknown option's key

Error message

%q is an unknown option's key

What it means

parseArg hit its default case: the comma-separated prometheus-rw output argument contains a key that is neither a known option nor a headers.* prefixed custom header. The unknown key is named in the error.

Source

Thrown at internal/output/prometheusrw/remotewrite/config.go:379

		// TODO: add the support for trendStats
		// strvals doesn't support the same format used by --summary-trend-stats
		// using the comma as the separator, because it is already used for
		// dividing the keys.
		//nolint:gocritic
		//
		//if v, ok := params["trendStats"].(string); ok && len(v) > 0 {
		//c.TrendStats = strings.Split(v, ",")
		//}

		case "clientCertificate":
			c.ClientCertificate = null.StringFrom(v)
		case "clientCertificateKey":
			c.ClientCertificateKey = null.StringFrom(v)

		default:
			if !strings.HasPrefix(key, "headers.") {
				return c, fmt.Errorf("%q is an unknown option's key", r[0])
			}
			if c.Headers == nil {
				c.Headers = make(map[string]string)
			}
			c.Headers[strings.TrimPrefix(key, "headers.")] = v
		}
	}

	return c, nil
}

func isSigV4PartiallyConfigured(region, accessKey, secretKey null.String) bool {
	hasRegion := region.Valid && len(strings.TrimSpace(region.String)) != 0
	hasAccessID := accessKey.Valid && len(strings.TrimSpace(accessKey.String)) != 0
	hasSecretAccessKey := secretKey.Valid && len(strings.TrimSpace(secretKey.String)) != 0
	// either they are all set, or all not set. False if partial
	isComplete := (hasRegion && hasAccessID && hasSecretAccessKey) || (!hasRegion && !hasAccessID && !hasSecretAccessKey)
	return !isComplete

View on GitHub (pinned to 01ffac6f24)

Solutions

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

Strategy: validation

When it happens

Trigger: Thrown at internal/output/prometheusrw/remotewrite/config.go:379 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/a8313fcf0fc9b799. Report an issue: GitHub.