{"record":{"id":"69c37a0303ba261f","repo":"grafana/k6","slug":"couldn-t-parse-the-loki-pushperiod-w","errorCode":null,"errorMessage":"couldn't parse the loki pushPeriod %w","messagePattern":"couldn't parse the loki pushPeriod %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/log/loki.go","lineNumber":160,"sourceCode":"\nfunc (opts *LokiHookOptions) parseArgs(line string) error {\n\ttokens, err := strvals.Parse(line)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error while parsing loki configuration %w\", err)\n\t}\n\n\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)","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/log/loki.go#L142-L178","documentation":"Raised in LokiHookOptions.parseArgs when the pushPeriod value cannot be parsed by time.ParseDuration. It means the Loki push interval is not a valid Go duration string. The at-fault input is the invalid pushPeriod value; the ParseDuration error is wrapped with %w.","triggerScenarios":"Thrown at internal/log/loki.go:160 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid duration like pushPeriod=1s, 500ms, or 1m","Include a time unit — bare numbers (e.g. pushPeriod=10) are invalid","See Go's time.ParseDuration format for accepted units"],"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"}