grafana/k6 · error

unknown key %q as argument for csv output

Error message

unknown key %q as argument for csv output

What it means

ParseArg for the csv output validates each comma-separated key=value option; any key other than saveInterval, fileName, or timeFormat reaches this default branch. It means the user passed an unsupported option name to the csv output's config string, so the output cannot be configured and k6 aborts startup.

Source

Thrown at internal/output/csv/config.go:88

	pairs := strings.SplitSeq(arg, ",")
	for pair := range pairs {
		k, v, _ := strings.Cut(pair, "=")
		if v == "" {
			return c, fmt.Errorf("couldn't parse %q as argument for csv output", arg)
		}
		switch k {
		case "saveInterval":
			err := c.SaveInterval.UnmarshalText([]byte(v))
			if err != nil {
				return c, err
			}
		case "fileName":
			c.FileName = null.StringFrom(v)
		case "timeFormat":
			c.TimeFormat = null.StringFrom(v)
		default:
			return c, fmt.Errorf("unknown key %q as argument for csv output", k)
		}
	}

	return c, nil
}

// GetConsolidatedConfig combines {default config values + JSON config +
// environment vars + arg config values}, and returns the final result.
func GetConsolidatedConfig(
	jsonRawConf json.RawMessage, env map[string]string, arg string,
) (Config, error) {
	result := NewConfig()
	if jsonRawConf != nil {
		jsonConf := Config{}
		if err := json.Unmarshal(jsonRawConf, &jsonConf); err != nil {
			return result, err
		}
		result = result.Apply(jsonConf)

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Fix the misspelled key or remove it from the --out csv=... argument
  2. Use only saveInterval, fileName and timeFormat keys
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/output/csv/config.go:88 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/549e90000a4085d8. Report an issue: GitHub.