ipfs/kubo · error

config setting IPNS.RepublishPeriod is not between 1min and

Error message

config setting IPNS.RepublishPeriod is not between 1min and 1day: %s

What it means

The IpnsRepublisher constructor re-validates the republish interval before starting the republisher goroutine: unless util.Debug is enabled, the interval must be between 1 minute and 24 hours. This is the second line of defense behind the identical check in core/node/groups.go; failing it aborts node startup.

Source

Thrown at core/node/ipns.go:54

			namesys.WithMaxCacheTTL(cacheMaxTTL),
		}

		if cacheSize > 0 {
			opts = append(opts, namesys.WithCache(cacheSize))
		}

		return namesys.NewNameSystem(rt, opts...)
	}
}

// IpnsRepublisher runs new IPNS republisher service
func IpnsRepublisher(repubPeriod time.Duration, recordLifetime time.Duration) func(lcStartStop, namesys.NameSystem, repo.Repo, crypto.PrivKey) error {
	return func(lc lcStartStop, namesys namesys.NameSystem, repo repo.Repo, privKey crypto.PrivKey) error {
		repub := republisher.NewRepublisher(namesys, repo.Datastore(), privKey, repo.Keystore())

		if repubPeriod != 0 {
			if !util.Debug && (repubPeriod < time.Minute || repubPeriod > (time.Hour*24)) {
				return fmt.Errorf("config setting IPNS.RepublishPeriod is not between 1min and 1day: %s", repubPeriod)
			}

			repub.Interval = repubPeriod
		}

		if recordLifetime != 0 {
			repub.RecordLifetime = recordLifetime
		}

		if repub.RecordLifetime < repub.Interval {
			return fmt.Errorf("config setting IPNS.RecordLifetime (%s) must be >= IPNS.RepublishPeriod (%s), otherwise records expire before they are republished", repub.RecordLifetime, repub.Interval)
		}

		lc.Append(repub.Run)
		return nil
	}
}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Pass a duration between 1 minute and 24 hours (e.g. 4h) when constructing IpnsRepublisher
  2. Pass 0 to let the republisher use its default interval instead of validating a custom one
  3. Build with the debug tag (util.Debug) if you need sub-minute intervals for testing

Example fix

// before
err := IpnsRepublisher(5*time.Second, 24*time.Hour)(lc, ns, r, privKey)
// after
err := IpnsRepublisher(4*time.Hour, 24*time.Hour)(lc, ns, r, privKey)
Defensive patterns

Strategy: validation

Validate before calling

if repubPeriod != 0 && (repubPeriod < time.Minute || repubPeriod > 24*time.Hour) {
    return fmt.Errorf("republishPeriod %s outside allowed 1m..24h", repubPeriod)
}

Prevention

When it happens

Trigger: Calling IpnsRepublisher (directly or via the fx graph) with repubPeriod != 0 that is < time.Minute or > 24h — i.e. the value came from IPNS.RepublishPeriod config or a programmatic caller passed an out-of-range duration.

Common situations: Embedding kubo-as-a-library and passing a custom republishPeriod like 5*time.Second; test harnesses wiring the republisher with tiny intervals; config values that passed a stale/modified constructor path.

Related errors


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/f586e0630c8b238e. Report an issue: GitHub.