{"record":{"id":"103988a5120f87f2","repo":"grafana/k6","slug":"s-should-be-a-boolean","errorCode":null,"errorMessage":"%s should be a boolean","messagePattern":"(.+?) should be a boolean","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/browser_options.go","lineNumber":137,"sourceCode":"\tif !bo.isRemoteBrowser {\n\t\treturn false\n\t}\n\n\tshouldIgnoreIfBrowserIsRemote := map[string]struct{}{\n\t\tenv.BrowserArguments:         {},\n\t\tenv.BrowserExecutablePath:    {},\n\t\tenv.BrowserHeadless:          {},\n\t\tenv.BrowserIgnoreDefaultArgs: {},\n\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,","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/browser_options.go#L119-L155","documentation":"parseBoolOpt runs strconv.ParseBool on every boolean-valued browser environment variable (K6_BROWSER_HEADLESS, K6_BROWSER_ENABLE_DEBUGGING) during BrowserOptions.Parse. ParseBool only accepts 1/t/T/TRUE/true/True/0/f/F/FALSE/false/False; anything else (e.g. \"yes\", \"enabled\", an empty value) fails and the error names the offending variable.","triggerScenarios":"Exporting K6_BROWSER_HEADLESS=yes, K6_BROWSER_HEADLESS=enabled, K6_BROWSER_ENABLE_DEBUGGING=1-with-junk, or an empty/whitespace value before running k6 with the browser module.","commonSituations":"CI pipelines that set booleans as yes/no; .env files with K6_BROWSER_HEADLESS=\"\" (quotes leak into the value); shell scripts using $VAR uninitialized, producing an empty string.","solutions":["Use a value strconv.ParseBool understands: true/false, 1/0, T/F.","Unset the variable instead of leaving it empty if you want the default behavior.","Check for stray quotes or trailing whitespace in the exported value."],"exampleFix":"# before\nexport K6_BROWSER_HEADLESS=yes\n\n# after\nexport K6_BROWSER_HEADLESS=true","handlingStrategy":"validation","validationCode":"# pre-flight in CI before k6 runs\nfor v in \"${K6_BROWSER_HEADLESS:-}\" \"${K6_BROWSER_ENABLE_DEBUGGING:-}\"; do\n  if [ -n \"$v\" ] && ! echo \"$v\" | grep -qxE '(1|0|t|f|T|F|true|false|TRUE|FALSE|True|False)'; then\n    echo \"boolean env var has invalid value: '$v'\" >&2; exit 1;\n  fi\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only true/false or 1/0 for K6_BROWSER_* booleans.","Unset variables you do not need rather than leaving them empty.","Quote .env values correctly; avoid yes/no spellings."],"tags":["environment","configuration","boolean","ci"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}