{"record":{"id":"9559789be4060737","repo":"ipfs/kubo","slug":"cannot-specify-negative-resolve-cache-size-955978","errorCode":null,"errorMessage":"cannot specify negative resolve cache size","messagePattern":"cannot specify negative resolve cache size","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/node/groups.go","lineNumber":321,"sourceCode":"\t\tfx.Invoke(libp2p.PstoreAddSelfKeys),\n\t)\n}\n\n// IPNS groups namesys related units\nvar IPNS = fx.Options(\n\tfx.Provide(RecordValidator),\n)\n\n// Online groups online-only units\nfunc Online(bcfg *BuildCfg, cfg *config.Config, userResourceOverrides rcmgr.PartialLimitConfig) fx.Option {\n\t// Namesys params\n\n\tipnsCacheSize := cfg.Ipns.ResolveCacheSize\n\tif ipnsCacheSize == 0 {\n\t\tipnsCacheSize = DefaultIpnsCacheSize\n\t}\n\tif ipnsCacheSize < 0 {\n\t\treturn fx.Error(errors.New(\"cannot specify negative resolve cache size\"))\n\t}\n\n\t// Republisher params\n\n\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}","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/node/groups.go#L303-L339","documentation":"`Ipns.ResolveCacheSize` controls how many IPNS records the local resolver caches. Negative values are nonsensical and rejected during Online (node) construction with this plain error, before any IPNS subsystem starts.","triggerScenarios":"`cfg.Ipns.ResolveCacheSize < 0` in the config when the Online fx group builds (called from Networked).","commonSituations":"Hand-edited config with a negative number; scripted config writes that subtract or misparse an integer; copying a placeholder value like -1 meaning 'default' from third-party docs.","solutions":["Set `ipfs config --json Ipns.ResolveCacheSize 128` (or another positive value; 0 selects the built-in DefaultIpnsCacheSize)","Remove the key entirely to fall back to the default","Re-check any script that writes ResolveCacheSize to avoid emitting negative values"],"exampleFix":"// before (config.json)\n\"Ipns\": { \"ResolveCacheSize\": -10 }\n// after\n\"Ipns\": { \"ResolveCacheSize\": 128 }","handlingStrategy":"validation","validationCode":"if cfg.Ipns.ResolveCacheSize < 0 {\n\treturn errors.New(\"Ipns.ResolveCacheSize must be >= 0 (0 = default)\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use 0 (or omit the key) to request the default cache size","Sanitize numeric config values written by scripts","Document that ResolveCacheSize is a non-negative integer"],"tags":["config","ipns","cache","validation"],"backgroundTag":"invalid-config-value","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"}