{"record":{"id":"ca608f8c364a76b7","repo":"grafana/k6","slug":"invalid-time-format-s","errorCode":null,"errorMessage":"invalid time format '%s'","messagePattern":"invalid time format '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/types/types.go","lineNumber":45,"sourceCode":"func ParseExtendedDuration(data string) (result time.Duration, err error) {\n\t// Assume millisecond values if data is provided with no units\n\tif t, errp := strconv.ParseFloat(data, 64); errp == nil {\n\t\treturn time.Duration(t * float64(time.Millisecond)), nil\n\t}\n\n\tdPos := strings.IndexByte(data, 'd')\n\tif dPos < 0 {\n\t\treturn time.ParseDuration(data)\n\t}\n\n\tvar hours time.Duration\n\tif dPos+1 < len(data) { // case \"12d\"\n\t\thours, err = time.ParseDuration(data[dPos+1:])\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\t\tif hours < 0 {\n\t\t\treturn 0, fmt.Errorf(\"invalid time format '%s'\", data[dPos+1:])\n\t\t}\n\t}\n\n\tdays, err := strconv.ParseInt(data[:dPos], 10, 64)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tif days < 0 {\n\t\thours = -hours\n\t}\n\treturn time.Duration(days)*24*time.Hour + hours, nil\n}\n\n// UnmarshalText converts text data to Duration\nfunc (d *Duration) UnmarshalText(data []byte) error {\n\tv, err := ParseExtendedDuration(string(data))\n\tif err != nil {\n\t\treturn err","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/lib/types/types.go#L27-L63","documentation":"Raised by ParseExtendedDuration, k6's duration parser that adds day (d) support on top of Go durations: when a 'd' unit is present, the remainder after the days part failed time.ParseDuration or was negative. Used for all duration-typed options.","triggerScenarios":"Thrown at lib/types/types.go:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use valid Go duration units after days, e.g. 1d12h30m or 2d","Avoid negative components like 1d-2h"],"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"}