ipfs/kubo · error

error parsing lifetime option: %s

Error message

error parsing lifetime option: %s

What it means

'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.

Source

Thrown at core/commands/name/publish.go:134

		}

		allowOffline, _ := req.Options[allowOfflineOptionName].(bool)
		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.

View on GitHub (pinned to 329838acdf)

Solutions

  1. Use a valid Go duration such as 24h, 720h or 30m -- no bare numbers or unusual units
  2. Check for stray characters, quotes or spaces in the option value
  3. Omit --lifetime to accept the default IPNS record lifetime
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/commands/name/publish.go:134 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/fe3fb75d1b370101. Report an issue: GitHub.