{"record":{"id":"e88c014967e31ec9","repo":"grafana/k6","slug":"loki-limit-needs-to-be-a-positive-number-is-d","errorCode":null,"errorMessage":"loki limit needs to be a positive number, is %d","messagePattern":"loki limit needs to be a positive number, is (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/log/loki.go","lineNumber":170,"sourceCode":"\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"loki\":\n\t\t\topts.Addr = value\n\t\tcase \"pushPeriod\":\n\t\t\topts.PushPeriod, err = time.ParseDuration(value)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"couldn't parse the loki pushPeriod %w\", err)\n\t\t\t}\n\t\tcase \"profile\":\n\t\t\topts.Profile = true\n\t\tcase \"limit\":\n\t\t\topts.Limit, err = strconv.Atoi(value)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"couldn't parse the loki limit as a number %w\", err)\n\t\t\t}\n\t\t\tif opts.Limit < 1 {\n\t\t\t\treturn fmt.Errorf(\"loki limit needs to be a positive number, is %d\", opts.Limit)\n\t\t\t}\n\t\tcase \"msgMaxSize\":\n\t\t\topts.MsgMaxSize, err = strconv.Atoi(value)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"couldn't parse the loki msgMaxSize as a number %w\", err)\n\t\t\t}\n\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","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/log/loki.go#L152-L188","documentation":"The Loki log output was configured with a limit option whose parsed integer value is less than 1. The limit controls how many log lines the internal buffer holds before dropping entries, so zero or negative values are rejected by parseArgs when building Loki options from a config line.","triggerScenarios":"Thrown at internal/log/loki.go:170 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the limit option in the Loki config line to a positive integer, e.g. --log-output=loki=...,limit=1000","Remove the limit key to fall back to the default limit"],"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-14T00:17:10.932Z"}