{"record":{"id":"f586e0630c8b238e","repo":"ipfs/kubo","slug":"config-setting-ipns-republishperiod-is-not-between-f586e0","errorCode":null,"errorMessage":"config setting IPNS.RepublishPeriod is not between 1min and 1day: %s","messagePattern":"config setting IPNS\\.RepublishPeriod is not between 1min and 1day: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/node/ipns.go","lineNumber":54,"sourceCode":"\t\t\tnamesys.WithMaxCacheTTL(cacheMaxTTL),\n\t\t}\n\n\t\tif cacheSize > 0 {\n\t\t\topts = append(opts, namesys.WithCache(cacheSize))\n\t\t}\n\n\t\treturn namesys.NewNameSystem(rt, opts...)\n\t}\n}\n\n// IpnsRepublisher runs new IPNS republisher service\nfunc IpnsRepublisher(repubPeriod time.Duration, recordLifetime time.Duration) func(lcStartStop, namesys.NameSystem, repo.Repo, crypto.PrivKey) error {\n\treturn func(lc lcStartStop, namesys namesys.NameSystem, repo repo.Repo, privKey crypto.PrivKey) error {\n\t\trepub := republisher.NewRepublisher(namesys, repo.Datastore(), privKey, repo.Keystore())\n\n\t\tif repubPeriod != 0 {\n\t\t\tif !util.Debug && (repubPeriod < time.Minute || repubPeriod > (time.Hour*24)) {\n\t\t\t\treturn fmt.Errorf(\"config setting IPNS.RepublishPeriod is not between 1min and 1day: %s\", repubPeriod)\n\t\t\t}\n\n\t\t\trepub.Interval = repubPeriod\n\t\t}\n\n\t\tif recordLifetime != 0 {\n\t\t\trepub.RecordLifetime = recordLifetime\n\t\t}\n\n\t\tif repub.RecordLifetime < repub.Interval {\n\t\t\treturn fmt.Errorf(\"config setting IPNS.RecordLifetime (%s) must be >= IPNS.RepublishPeriod (%s), otherwise records expire before they are republished\", repub.RecordLifetime, repub.Interval)\n\t\t}\n\n\t\tlc.Append(repub.Run)\n\t\treturn nil\n\t}\n}\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/node/ipns.go#L36-L72","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a duration between 1 minute and 24 hours (e.g. 4h) when constructing IpnsRepublisher","Pass 0 to let the republisher use its default interval instead of validating a custom one","Build with the debug tag (util.Debug) if you need sub-minute intervals for testing"],"exampleFix":"// before\nerr := IpnsRepublisher(5*time.Second, 24*time.Hour)(lc, ns, r, privKey)\n// after\nerr := IpnsRepublisher(4*time.Hour, 24*time.Hour)(lc, ns, r, privKey)","handlingStrategy":"validation","validationCode":"if repubPeriod != 0 && (repubPeriod < time.Minute || repubPeriod > 24*time.Hour) {\n    return fmt.Errorf(\"republishPeriod %s outside allowed 1m..24h\", repubPeriod)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass 0 for default behavior instead of tiny intervals in embedders/tests","Keep custom intervals within 1m..24h; use util.Debug builds only for short-interval tests"],"tags":["ipns","config","startup"],"backgroundTag":"config-value-out-of-range","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"}