{"record":{"id":"82f4c26c1f41ef17","repo":"ipfs/kubo","slug":"lifetime-must-be-greater-than-zero-got-s","errorCode":null,"errorMessage":"lifetime must be greater than zero, got %s","messagePattern":"lifetime must be greater than zero, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/name/publish.go","lineNumber":137,"sourceCode":"\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.\n\t\tif ttl, found := req.Options[ttlOptionName].(string); found {\n\t\t\td, err := time.ParseDuration(ttl)\n\t\t\tif err != nil {","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/name/publish.go#L119-L155","documentation":"Fired by `ipfs name publish` when the --lifetime option is explicitly set to a duration that parses but is zero or negative. IPNS record lifetime must be strictly positive for the record to be meaningful; such a value is rejected after parsing and before the record is published. The default lifetime (ipns.DefaultRecordLifetime) applies when the flag is not set.","triggerScenarios":"Thrown at core/commands/name/publish.go:137 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set --lifetime to a positive duration, e.g. 24h or 720h","Omit the flag to use ipns.DefaultRecordLifetime"],"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"}