{"record":{"id":"b1d7de4f29738f79","repo":"grafana/k6","slug":"invalid-dns-ttl-s-b1d7de","errorCode":null,"errorMessage":"invalid DNS TTL: %s","messagePattern":"invalid DNS TTL: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/runner.go","lineNumber":623,"sourceCode":"\treturn nil\n}\n\nfunc parseTTL(ttlS string) (time.Duration, error) {\n\tttl := time.Duration(0)\n\tswitch ttlS {\n\tcase \"inf\":\n\t\t// cache \"infinitely\"\n\t\tttl = time.Hour * 24 * 365\n\tcase \"0\":\n\t\t// disable cache\n\tcase \"\":\n\t\tttlS = types.DefaultDNSConfig().TTL.String\n\t\tfallthrough\n\tdefault:\n\t\tvar err error\n\t\tttl, err = types.ParseExtendedDuration(ttlS)\n\t\tif ttl < 0 || err != nil {\n\t\t\treturn ttl, fmt.Errorf(\"invalid DNS TTL: %s\", ttlS)\n\t\t}\n\t}\n\treturn ttl, nil\n}\n\n// Runs an exported function in its own temporary VU, optionally with an argument. Execution is\n// interrupted if the context expires. No error is returned if the part does not exist.\nfunc (r *Runner) runPart(\n\tparentCtx context.Context,\n\tout chan<- metrics.SampleContainer,\n\tname string,\n\targ any,\n) (sobek.Value, error) {\n\tctx, cancel := context.WithCancel(parentCtx)\n\tdefer cancel()\n\n\tvu, err := r.newVU(ctx, 0, 0, out)\n\tif err != nil {","sourceCodeStart":605,"sourceCodeEnd":641,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/runner.go#L605-L641","documentation":"The ttl value of the host resolver options (K6_DNS_TTL or dns.ttl option) is neither 'inf', '0', empty, nor a parseable positive duration. ParseExtendedDuration handles extended formats like '1h30m' and k8s-style '300ms'; a negative, malformed, or non-numeric string falls through to this error when the resolver is configured at startup.","triggerScenarios":"Thrown at internal/js/runner.go:623 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid duration string such as '1m', '30s', '500ms', or the special values '0' (no caching) and 'inf' (cache for a year)","Check for typos and stray units in the K6_DNS_TTL environment variable and the dns.ttl option","Avoid negative values; TTL must be zero or positive"],"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"}