{"record":{"id":"56ecfb38ea415d36","repo":"grafana/k6","slug":"parsing-ttl-w","errorCode":null,"errorMessage":"parsing TTL: %w","messagePattern":"parsing TTL: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/network_manager.go","lineNumber":169,"sourceCode":"\t\t\"connectionaborted\":    network.ErrorReasonConnectionAborted,\n\t\t\"connectionclosed\":     network.ErrorReasonConnectionClosed,\n\t\t\"connectionfailed\":     network.ErrorReasonConnectionFailed,\n\t\t\"connectionrefused\":    network.ErrorReasonConnectionRefused,\n\t\t\"connectionreset\":      network.ErrorReasonConnectionReset,\n\t\t\"internetdisconnected\": network.ErrorReasonInternetDisconnected,\n\t\t\"namenotresolved\":      network.ErrorReasonNameNotResolved,\n\t\t\"timedout\":             network.ErrorReasonTimedOut,\n\t\t\"failed\":               network.ErrorReasonFailed,\n\t}\n}\n\n// Returns a new Resolver.\n// Copied with minor changes from\n// https://github.com/grafana/k6/blob/fb70bc6f3d3f22a40e65f32deea3cea1b6d70a76/js/runner.go#L459\nfunc newResolver(conf k6types.DNSConfig) (k6netext.Resolver, error) {\n\tttl, err := parseTTL(conf.TTL.String)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing TTL: %w\", err)\n\t}\n\n\tdnsSel := conf.Select\n\tif !dnsSel.Valid {\n\t\tdnsSel = k6types.DefaultDNSConfig().Select\n\t}\n\tdnsPol := conf.Policy\n\tif !dnsPol.Valid {\n\t\tdnsPol = k6types.DefaultDNSConfig().Policy\n\t}\n\treturn k6netext.NewResolver(\n\t\tnet.LookupIP, ttl, dnsSel.DNSSelect, dnsPol.DNSPolicy), nil\n}\n\n// Parse a string representation of TTL to time.Duration.\n// Copied from https://github.com/grafana/k6/blob/fb70bc6f3d3f22a40e65f32deea3cea1b6d70a76/js/runner.go#L479\nfunc parseTTL(ttlS string) (time.Duration, error) {\n\tttl := time.Duration(0)","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/common/network_manager.go#L151-L187","documentation":"Failure to parse a TTL string into time.Duration while building the resolver from the DNS options. The sentinel is produced by parseTTL (which accepts 'inf', '0', or an extended duration) — the offending input is the ttl value of the k6 DNS configuration.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/network_manager.go:169 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set dns.ttl to 'inf', '0', or a valid duration like '300s' / '5m'","Avoid arbitrary strings; ttl must be an extended Go duration","Check environment-variable-provided DNS settings for typos"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}