grafana/k6 · error
unknown loki config key %s
Error message
unknown loki config key %s
What it means
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.
Source
Thrown at internal/log/loki.go:195
if opts.MsgMaxSize < 1 {
return fmt.Errorf("loki msgMaxSize needs to be a positive number, is %d", opts.MsgMaxSize)
}
case "level":
opts.Level = value
case "allowedLabels":
opts.AllowedLabels = strings.Split(value, ",")
default:
if after, ok := strings.CutPrefix(key, "label."); ok {
opts.Labels = append(opts.Labels, [2]string{after, value})
continue
} else if after, ok := strings.CutPrefix(key, "header."); ok {
opts.Headers = append(opts.Headers, [2]string{after, value})
continue
}
return fmt.Errorf("unknown loki config key %s", key)
}
}
return nil
}
// Listen fills one of two equally sized slices
// with entries and then push it while filling the other one.
//
// TODO benchmark this
//
//nolint:funlen,gocognit
func (h *lokiHook) Listen(ctx context.Context) {
var (
msgs = make([]tmpMsg, h.limit)
msgsToPush = make([]tmpMsg, h.limit)
dropped int
count intView on GitHub (pinned to 01ffac6f24)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/log/loki.go:195 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/605da63b58bbc26d.
Report an issue: GitHub.