grafana/k6 · error

there was no ',' after an array with key '%s'

Error message

there was no ',' after an array with key '%s'

What it means

An array value in the strvals string (delimited by [ ]) was closed with ']' but was not followed by ',' or the end of input. The tokenizer requires a separator after an array element; anything else (e.g. 'k=[1,2]x') is treated as malformed input and aborts parsing. The error names the key whose array triggered it.

Source

Thrown at internal/lib/strvals/parser.go:61

			return t.s[start : t.i-1]
		}
	}

	return t.s[start:]
}

func (t *tokenizer) readArray() (string, error) {
	start := t.i
	for ; t.i < len(t.s); t.i++ {
		if t.s[t.i] == ']' {
			if t.i+1 == len(t.s) || t.s[t.i+1] == ',' {
				t.i += 2

				return t.s[start : t.i-2], nil
			}
			t.i++

			return t.s[start : t.i-1], fmt.Errorf("there was no ',' after an array with key '%s'", t.currentKey)
		}
	}

	return t.s[start:], fmt.Errorf("array value for key `%s` didn't end", t.currentKey)
}

// Parse parses the input string into key-value tokens following strvals format:
// name=value,topname.subname=value.
func Parse(s string) ([]Token, error) {
	result := []Token{}
	t := &tokenizer{s: s}

	var err error
	var value string
	for t.i < len(s) {
		t.currentKey, err = t.readKey()
		if err != nil {
			return result, err

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Put a ',' immediately after the closing ']' or end the string there
  2. Remove stray characters between the array's ']' and the next key
  3. Review the strvals syntax: elements are separated by commas, arrays use square brackets
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/lib/strvals/parser.go:61 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/e5e25d0e3ef93695. Report an issue: GitHub.