{"record":{"id":"4be291f79b39abdd","repo":"grafana/k6","slug":"loki-msgmaxsize-needs-to-be-a-positive-number-is","errorCode":null,"errorMessage":"loki msgMaxSize needs to be a positive number, is %d","messagePattern":"loki msgMaxSize needs to be a positive number, is (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/log/loki.go","lineNumber":178,"sourceCode":"\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\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}","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/log/loki.go#L160-L196","documentation":"The msgMaxSize option of the Loki log output parsed successfully as an integer but is below 1. msgMaxSize caps the size of individual messages pushed to Loki, so zero or negative values are meaningless and are rejected by parseArgs.","triggerScenarios":"Thrown at internal/log/loki.go:178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set msgMaxSize to a positive integer, e.g. --log-output=loki=...,msgMaxSize=1000","Omit msgMaxSize to use the default maximum message size"],"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"}