{"record":{"id":"7d07a7f5f25142f0","repo":"grafana/k6","slug":"couldn-t-parse-the-loki-limit-as-a-number-w","errorCode":null,"errorMessage":"couldn't parse the loki limit as a number %w","messagePattern":"couldn't parse the loki limit as a number %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/log/loki.go","lineNumber":167,"sourceCode":"\tfor _, token := range tokens {\n\t\tkey := token.Key\n\t\tvalue := token.Value\n\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 {","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/log/loki.go#L149-L185","documentation":"Raised in LokiHookOptions.parseArgs when the limit value cannot be parsed by strconv.Atoi. It means the Loki log-entry limit is not an integer. The at-fault input is the non-numeric limit value; the Atoi error is wrapped with %w.","triggerScenarios":"Thrown at internal/log/loki.go:167 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a plain integer, e.g. limit=100","Remove quotes or stray characters around the number","Ensure the value has no units or decimals"],"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"}