{"record":{"id":"321742d01b2ae308","repo":"grafana/k6","slug":"array-value-for-key-s-didn-t-end","errorCode":null,"errorMessage":"array value for key `%s` didn't end","messagePattern":"array value for key `(.+?)` didn't end","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/lib/strvals/parser.go","lineNumber":65,"sourceCode":"\treturn t.s[start:]\n}\n\nfunc (t *tokenizer) readArray() (string, error) {\n\tstart := t.i\n\tfor ; t.i < len(t.s); t.i++ {\n\t\tif t.s[t.i] == ']' {\n\t\t\tif t.i+1 == len(t.s) || t.s[t.i+1] == ',' {\n\t\t\t\tt.i += 2\n\n\t\t\t\treturn t.s[start : t.i-2], nil\n\t\t\t}\n\t\t\tt.i++\n\n\t\t\treturn t.s[start : t.i-1], fmt.Errorf(\"there was no ',' after an array with key '%s'\", t.currentKey)\n\t\t}\n\t}\n\n\treturn t.s[start:], fmt.Errorf(\"array value for key `%s` didn't end\", t.currentKey)\n}\n\n// Parse parses the input string into key-value tokens following strvals format:\n// name=value,topname.subname=value.\nfunc Parse(s string) ([]Token, error) {\n\tresult := []Token{}\n\tt := &tokenizer{s: s}\n\n\tvar err error\n\tvar value string\n\tfor t.i < len(s) {\n\t\tt.currentKey, err = t.readKey()\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\t\tif t.s[t.i] == '[' {\n\t\t\tt.i++\n\t\t\tvalue, err = t.readArray()","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/lib/strvals/parser.go#L47-L83","documentation":"An array value opened with '[' was never closed before the input ended; the tokenizer scanned to end-of-string without finding ']'. A typical cause is a truncated otel/traces option string like 'otel=k=[v1,v2'. The error names the key whose array was left unterminated, and the whole parse fails.","triggerScenarios":"Thrown at internal/lib/strvals/parser.go:65 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Close the array with a matching ']'","Check for truncated or partially-edited option strings","Escape literal brackets in values per the strvals format if they are not meant as arrays"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}