grafana/k6 · error

couldn't parse %q as argument for csv output

Error message

couldn't parse %q as argument for csv output

What it means

While parsing the CSV output argument string, a key=value pair was found whose value side is empty (e.g. "fileName=" or a trailing comma pair). ParseArg rejects any pair with an empty value for the CSV output configuration.

Source

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

		c.TimeFormat = cfg.TimeFormat
	}
	return c
}

// ParseArg takes an arg string and converts it to a config
func ParseArg(arg string) (Config, error) {
	c := NewConfig()

	if !strings.Contains(arg, "=") {
		c.FileName = null.StringFrom(arg)
		return c, nil
	}

	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
}

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Provide a value for every key, e.g. --out csv=file=result.csv,saveInterval=1s
  2. Remove keys you don't want to set instead of leaving them empty
Defensive patterns

Strategy: validation

When it happens

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