{"record":{"id":"fe3fb75d1b370101","repo":"ipfs/kubo","slug":"error-parsing-lifetime-option-s","errorCode":null,"errorMessage":"error parsing lifetime option: %s","messagePattern":"error parsing lifetime option: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/name/publish.go","lineNumber":134,"sourceCode":"\t\t}\n\n\t\tallowOffline, _ := req.Options[allowOfflineOptionName].(bool)\n\t\tallowDelegated, _ := req.Options[allowDelegatedOptionName].(bool)\n\t\tcompatibleWithV1, _ := req.Options[v1compatOptionName].(bool)\n\t\tkname, _ := req.Options[keyOptionName].(string)\n\n\t\t// Validate flag combinations\n\t\tif allowOffline && allowDelegated {\n\t\t\treturn errors.New(\"cannot use both --allow-offline and --allow-delegated flags\")\n\t\t}\n\n\t\t// --lifetime and --ttl carry no client-side default, so the server can\n\t\t// tell whether the user set them explicitly; defaults are applied here.\n\t\tvalidTime := ipns.DefaultRecordLifetime\n\t\tif validTimeOpt, found := req.Options[lifeTimeOptionName].(string); found {\n\t\t\td, err := time.ParseDuration(validTimeOpt)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error parsing lifetime option: %s\", err)\n\t\t\t}\n\t\t\tif d <= 0 {\n\t\t\t\treturn fmt.Errorf(\"lifetime must be greater than zero, got %s\", validTimeOpt)\n\t\t\t}\n\t\t\tvalidTime = d\n\t\t}\n\n\t\topts := []options.NamePublishOption{\n\t\t\toptions.Name.AllowOffline(allowOffline),\n\t\t\toptions.Name.AllowDelegated(allowDelegated),\n\t\t\toptions.Name.Key(kname),\n\t\t\toptions.Name.ValidTime(validTime),\n\t\t\toptions.Name.CompatibleWithV1(compatibleWithV1),\n\t\t}\n\n\t\t// A record is not cached past its validity, so the TTL must not exceed the\n\t\t// lifetime. An explicit --ttl over the lifetime is an error; the default\n\t\t// --ttl is capped to the lifetime instead.","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/name/publish.go#L116-L152","documentation":"'ipfs name publish' could not parse the --lifetime option value as a Go duration string; the option is read raw (no client-side default) so an arbitrary malformed string reaches time.ParseDuration here.","triggerScenarios":"Thrown at core/commands/name/publish.go:134 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid Go duration such as 24h, 720h or 30m -- no bare numbers or unusual units","Check for stray characters, quotes or spaces in the option value","Omit --lifetime to accept the default IPNS record lifetime"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}