{"record":{"id":"605da63b58bbc26d","repo":"grafana/k6","slug":"unknown-loki-config-key-s","errorCode":null,"errorMessage":"unknown loki config key %s","messagePattern":"unknown loki config key (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/log/loki.go","lineNumber":195,"sourceCode":"\t\t\tif opts.MsgMaxSize < 1 {\n\t\t\t\treturn fmt.Errorf(\"loki msgMaxSize needs to be a positive number, is %d\", opts.MsgMaxSize)\n\t\t\t}\n\t\tcase \"level\":\n\t\t\topts.Level = value\n\t\tcase \"allowedLabels\":\n\t\t\topts.AllowedLabels = strings.Split(value, \",\")\n\t\tdefault:\n\t\t\tif after, ok := strings.CutPrefix(key, \"label.\"); ok {\n\t\t\t\topts.Labels = append(opts.Labels, [2]string{after, value})\n\n\t\t\t\tcontinue\n\t\t\t} else if after, ok := strings.CutPrefix(key, \"header.\"); ok {\n\t\t\t\topts.Headers = append(opts.Headers, [2]string{after, value})\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\treturn fmt.Errorf(\"unknown loki config key %s\", key)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// Listen fills one of two equally sized slices\n// with entries and then push it while filling the other one.\n//\n// TODO benchmark this\n//\n//nolint:funlen,gocognit\nfunc (h *lokiHook) Listen(ctx context.Context) {\n\tvar (\n\t\tmsgs       = make([]tmpMsg, h.limit)\n\t\tmsgsToPush = make([]tmpMsg, h.limit)\n\t\tdropped    int\n\t\tcount      int","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/log/loki.go#L177-L213","documentation":"parseArgs encountered a key=value pair in the Loki config line whose key matches no known option (loki, pushPeriod, profile, limit, msgMaxSize, level, allowedLabels) and no label./header. prefix. The offending key is the unknown configuration key.","triggerScenarios":"Thrown at internal/log/loki.go:195 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the misspelled key or remove it from the Loki config line","Use label.<name>=<value> or header.<name>=<value> for custom labels and headers"],"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"}