{"record":{"id":"8990451fd0a359fb","repo":"grafana/k6","slug":"unable-to-parse-expires-date-string-s-w","errorCode":null,"errorMessage":"unable to parse \"expires\" date string \"%s\": %w","messagePattern":"unable to parse \"expires\" date string \"(.+?)\": %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"js/modules/k6/http/cookiejar.go","lineNumber":69,"sourceCode":"\t}\n\n\tc := http.Cookie{Name: name, Value: value}\n\tparamsV := opts\n\tif !common.IsNullish(paramsV) {\n\t\tparams := paramsV.ToObject(rt)\n\t\tfor _, k := range params.Keys() {\n\t\t\tswitch strings.ToLower(k) {\n\t\t\tcase \"path\":\n\t\t\t\tc.Path = params.Get(k).String()\n\t\t\tcase \"domain\":\n\t\t\t\tc.Domain = params.Get(k).String()\n\t\t\tcase \"expires\":\n\t\t\t\tvar t time.Time\n\t\t\t\texpires := params.Get(k).String()\n\t\t\t\tif expires != \"\" {\n\t\t\t\t\tt, err = time.Parse(time.RFC1123, expires)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn false, fmt.Errorf(`unable to parse \"expires\" date string \"%s\": %w`, expires, err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tc.Expires = t\n\t\t\tcase \"max_age\":\n\t\t\t\tc.MaxAge = int(params.Get(k).ToInteger())\n\t\t\tcase \"secure\":\n\t\t\t\tc.Secure = params.Get(k).ToBoolean()\n\t\t\tcase \"http_only\":\n\t\t\t\tc.HttpOnly = params.Get(k).ToBoolean()\n\t\t\t}\n\t\t}\n\t}\n\tj.Jar.SetCookies(u, []*http.Cookie{&c})\n\treturn true, nil\n}\n\n// Clear all cookies for a particular URL\nfunc (j CookieJar) Clear(url string) error {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/js/modules/k6/http/cookiejar.go#L51-L87","documentation":"In the http cookiejar Set method, an expires parameter that is non-empty must parse as time.RFC1123; this error wraps time.Parse's failure for a malformed date string (e.g. \"tomorrow\" or missing GMT). The cookie is not set and the error propagates to the script.","triggerScenarios":"Thrown at js/modules/k6/http/cookiejar.go:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide expires in RFC 1123 format, e.g. 'Wed, 21 Oct 2026 07:28:00 GMT'","Or pass a Date object / omit expires for a session cookie"],"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"}