{"record":{"id":"9f3d359690102b3a","repo":"ipfs/kubo","slug":"failure-to-parse-config-setting-ipns-recordlifetim","errorCode":null,"errorMessage":"failure to parse config setting IPNS.RecordLifetime: %s","messagePattern":"failure to parse config setting IPNS\\.RecordLifetime: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/node/groups.go","lineNumber":344,"sourceCode":"\tvar repubPeriod, recordLifetime time.Duration\n\n\tif cfg.Ipns.RepublishPeriod != \"\" {\n\t\td, err := time.ParseDuration(cfg.Ipns.RepublishPeriod)\n\t\tif err != nil {\n\t\t\treturn fx.Error(fmt.Errorf(\"failure to parse config setting IPNS.RepublishPeriod: %s\", err))\n\t\t}\n\n\t\tif !util.Debug && (d < time.Minute || d > (time.Hour*24)) {\n\t\t\treturn fx.Error(fmt.Errorf(\"config setting IPNS.RepublishPeriod is not between 1min and 1day: %s\", d))\n\t\t}\n\n\t\trepubPeriod = d\n\t}\n\n\tif cfg.Ipns.RecordLifetime != \"\" {\n\t\td, err := time.ParseDuration(cfg.Ipns.RecordLifetime)\n\t\tif err != nil {\n\t\t\treturn fx.Error(fmt.Errorf(\"failure to parse config setting IPNS.RecordLifetime: %s\", err))\n\t\t}\n\n\t\trecordLifetime = d\n\t}\n\n\tisBitswapLibp2pEnabled := cfg.Bitswap.Libp2pEnabled.WithDefault(config.DefaultBitswapLibp2pEnabled)\n\tisBitswapServerEnabled := cfg.Bitswap.ServerEnabled.WithDefault(config.DefaultBitswapServerEnabled)\n\tisHTTPRetrievalEnabled := cfg.HTTPRetrieval.Enabled.WithDefault(config.DefaultHTTPRetrievalEnabled)\n\n\t// The Provide system handles both new CID announcements and periodic\n\t// re-announcements. Provide.Enabled=false fully disables it.\n\t// Provide.DHT.Interval=0 disables only the periodic reprovide schedule;\n\t// new CIDs still announce via fast-provide-root and 'ipfs provide once'.\n\tisProviderEnabled := cfg.Provide.Enabled.WithDefault(config.DefaultProvideEnabled)\n\n\treturn fx.Options(\n\t\tfx.Provide(BitswapOptions(cfg)),\n\t\tfx.Provide(Bitswap(isBitswapServerEnabled, isBitswapLibp2pEnabled, isHTTPRetrievalEnabled)),","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/node/groups.go#L326-L362","documentation":"The daemon parses IPNS.RecordLifetime with time.ParseDuration during Online node construction. If the configured string is not a valid Go duration (e.g. \"1 day\" or \"24h30m\" typos like \"24h30\"), fx construction aborts and the daemon exits with this error.","triggerScenarios":"IPNS.RecordLifetime is non-empty in the config and `ipfs daemon` starts; time.ParseDuration fails on the stored string.","commonSituations":"Human-style values like \"1 week\", \"2 days\" or \"1d\" are not Go durations; trailing whitespace or locale characters in a hand-edited config; scripts writing malformed values via `ipfs config`.","solutions":["Run `ipfs config Ipns.RecordLifetime` to inspect the value, then set a valid Go duration: `ipfs config Ipns.RecordLifetime 48h`","Validate locally first: `go run` / quick check that `time.ParseDuration(\"<value>\")` succeeds; valid units are ns, us, ms, s, m, h (no \"d\")","Clear the setting to use the default record lifetime: `ipfs config --json Ipns.RecordLifetime \"\"`"],"exampleFix":"// before (config.json)\n\"Ipns\": { \"RecordLifetime\": \"2 days\" }\n// after\n\"Ipns\": { \"RecordLifetime\": \"48h\" }","handlingStrategy":"validation","validationCode":"if _, err := time.ParseDuration(cfg.Ipns.RecordLifetime); cfg.Ipns.RecordLifetime != \"\" && err != nil {\n    return fmt.Errorf(\"IPNS.RecordLifetime %q is not a valid Go duration (units: ns,us,ms,s,m,h)\", cfg.Ipns.RecordLifetime)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only ever write durations using Go units (h, m, s); never \"days\" or \"d\"","Validate the string with time.ParseDuration before persisting to config"],"tags":["ipns","config","duration-parse"],"backgroundTag":"invalid-duration-format","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"}