{"record":{"id":"8aed59cb4f01b9bb","repo":"grafana/k6","slug":"s-should-be-a-time-duration-value-w","errorCode":null,"errorMessage":"%s should be a time duration value: %w","messagePattern":"(.+?) should be a time duration value: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/browser_options.go","lineNumber":146,"sourceCode":"\t}\n\t_, ignore := shouldIgnoreIfBrowserIsRemote[opt]\n\n\treturn ignore\n}\n\nfunc parseBoolOpt(k, v string) (bool, error) {\n\tb, err := strconv.ParseBool(v)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"%s should be a boolean\", k)\n\t}\n\n\treturn b, nil\n}\n\nfunc parseTimeOpt(k, v string) (time.Duration, error) {\n\tt, err := types.GetDurationValue(v)\n\tif err != nil {\n\t\treturn time.Duration(0), fmt.Errorf(\"%s should be a time duration value: %w\", k, err)\n\t}\n\n\treturn t, nil\n}\n\nfunc parseListOpt(v string) []string {\n\telems := strings.Split(v, \",\")\n\t// If last element is a void string,\n\t// because value contained an ending comma,\n\t// remove it\n\tif elems[len(elems)-1] == \"\" {\n\t\telems = elems[:len(elems)-1]\n\t}\n\n\treturn elems\n}\n","sourceCodeStart":128,"sourceCodeEnd":163,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/browser_options.go#L128-L163","documentation":"parseTimeOpt converts the K6_BROWSER_GLOBAL_TIMEOUT environment variable via types.GetDurationValue. That helper accepts Go/k6 duration strings (\"30s\", \"1m30s\", \"1h\", or a bare number of milliseconds); anything unparseable makes Parse fail, and the message includes both the variable name and the underlying parse error from the %w chain.","triggerScenarios":"Setting K6_BROWSER_GLOBAL_TIMEOUT to a non-duration string such as \"thirty seconds\", \"30 sec\" (space form), \"1.5 minutes\", or \"timeout\".","commonSituations":"Configuring a global browser timeout in CI with human-readable text; copying values from documentation of other tools; locale differences like comma decimals (\"1,5s\").","solutions":["Use a Go duration literal: K6_BROWSER_GLOBAL_TIMEOUT=30s or 1m or 1h30m.","A bare integer is treated as milliseconds (e.g. 30000 for 30s); use that form if convenient.","Verify no stray quotes or units like \"ms\" appended twice (\"30sms\")."],"exampleFix":"# before\nexport K6_BROWSER_GLOBAL_TIMEOUT='30 seconds'\n\n# after\nexport K6_BROWSER_GLOBAL_TIMEOUT=30s","handlingStrategy":"validation","validationCode":"# verify duration parses as Go/k6 duration (integer also OK: treated as ms)\nV=\"${K6_BROWSER_GLOBAL_TIMEOUT:-}\"\n[ -z \"$V\" ] || echo \"$V\" | grep -qxE '([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+|[0-9]+' \\\n  || { echo \"K6_BROWSER_GLOBAL_TIMEOUT is not a duration: '$V'\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use unit-suffixed Go durations (30s, 1m, 1h30m).","Copy timeout values from k6 docs, not from other tools' formats.","Validate environment in a CI pre-flight step so failures happen before the load test starts."],"tags":["environment","configuration","timeout","duration"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}