ipfs/kubo · error
lifetime must be greater than zero, got %s
Error message
lifetime must be greater than zero, got %s
What it means
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.
Source
Thrown at core/commands/name/publish.go:137
allowDelegated, _ := req.Options[allowDelegatedOptionName].(bool)
compatibleWithV1, _ := req.Options[v1compatOptionName].(bool)
kname, _ := req.Options[keyOptionName].(string)
// Validate flag combinations
if allowOffline && allowDelegated {
return errors.New("cannot use both --allow-offline and --allow-delegated flags")
}
// --lifetime and --ttl carry no client-side default, so the server can
// tell whether the user set them explicitly; defaults are applied here.
validTime := ipns.DefaultRecordLifetime
if validTimeOpt, found := req.Options[lifeTimeOptionName].(string); found {
d, err := time.ParseDuration(validTimeOpt)
if err != nil {
return fmt.Errorf("error parsing lifetime option: %s", err)
}
if d <= 0 {
return fmt.Errorf("lifetime must be greater than zero, got %s", validTimeOpt)
}
validTime = d
}
opts := []options.NamePublishOption{
options.Name.AllowOffline(allowOffline),
options.Name.AllowDelegated(allowDelegated),
options.Name.Key(kname),
options.Name.ValidTime(validTime),
options.Name.CompatibleWithV1(compatibleWithV1),
}
// A record is not cached past its validity, so the TTL must not exceed the
// lifetime. An explicit --ttl over the lifetime is an error; the default
// --ttl is capped to the lifetime instead.
if ttl, found := req.Options[ttlOptionName].(string); found {
d, err := time.ParseDuration(ttl)
if err != nil {View on GitHub (pinned to 329838acdf)
Solutions
- Set --lifetime to a positive duration, e.g. 24h or 720h
- Omit the flag to use ipns.DefaultRecordLifetime
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/commands/name/publish.go:137 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/82f4c26c1f41ef17.
Report an issue: GitHub.