{"record":{"id":"f16c076db34ffc31","repo":"weaviate/weaviate","slug":"parse-lazy-load-shard-warmup-min-objects-as-int","errorCode":null,"errorMessage":"parse LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS as int: %w","messagePattern":"parse LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS as int: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/config/environment.go","lineNumber":181,"sourceCode":"\t\t}\n\t\tif asInt < 0 {\n\t\t\treturn fmt.Errorf(\"LAZY_LOAD_SHARD_COUNT_THRESHOLD must be >= 0\")\n\t\t}\n\t\tconfig.LazyLoadShardCountThreshold = asInt\n\t\tif config.LazyLoadShardCountThreshold == 0 {\n\t\t\tv := true\n\t\t\tconfig.EnableLazyLoadShards = &v\n\t\t}\n\t} else {\n\t\tconfig.LazyLoadShardCountThreshold = DefaultLazyLoadShardCountThreshold\n\t}\n\n\t// Written only when the variable is set, so a value from the config file\n\t// survives.\n\tif v := os.Getenv(\"LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS\"); v != \"\" {\n\t\tasInt, err := strconv.ParseInt(v, 10, 64)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"parse LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS as int: %w\", err)\n\t\t}\n\t\tconfig.LazyLoadShardWarmupMinObjects = asInt\n\t}\n\t// Eager loading ignores the knob entirely, so warning there would describe a\n\t// state no collection on this node is in. Auto-detection is resolved per\n\t// collection later, so a nil setting still warns.\n\tif minObjects := config.LazyLoadShardWarmupMinObjects; minObjects != 0 &&\n\t\t(config.EnableLazyLoadShards == nil || *config.EnableLazyLoadShards) {\n\t\tleft := fmt.Sprintf(\"only shards holding more than %d objects are warmed up\", minObjects)\n\t\tif minObjects < 0 {\n\t\t\tleft = \"no shard is warmed up\"\n\t\t}\n\t\tlogrus.Warnf(\"LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS is %d, so on a collection using lazy loading %s. \"+\n\t\t\t\"A HOT tenant left out stays unloaded until first access. \"+\n\t\t\t\"While it is unloaded the TTL sweep keeps its expired objects, async replication leaves a \"+\n\t\t\t\"stale replica unrepaired, and MAXIMUM_ALLOWED_OBJECTS_COUNT stops counting it, so this \"+\n\t\t\t\"node admits writes past its cap.\",\n\t\t\tminObjects, left)","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/config/environment.go#L163-L199","documentation":"FromEnv parses LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS with strconv.ParseInt(v, 10, 64) to set the minimum object count a shard must have to remain lazily loaded without warming up. A non-integer value causes the ParseInt error to be wrapped as \"parse LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS as int: %w\" and aborts config loading. Unlike the count threshold, no explicit range validation follows, but a 64-bit overflow also fails here.","triggerScenarios":"LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS set to a string strconv.ParseInt rejects: floats (\"1000.0\"), scientific notation (\"1e6\"), hex (\"0x64\"), underscores, empty/whitespace strings, or a number exceeding int64 range.","commonSituations":"Values copied from JSON/YAML configs that used floats; a value like \"10000000000000000000\" (> int64 max); templating errors leaving \"${...}\" unresolved in the env value.","solutions":["Set the variable to a plain base-10 integer, e.g. LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS=10000.","Unset the variable to keep the default warmup threshold.","Fix templating/secret-substitution so the raw placeholder is not passed through to the container."],"exampleFix":"// before\nLAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS=1e6\n// after\nLAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS=1000000","handlingStrategy":"validation","validationCode":"v := os.Getenv(\"LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS\")\nif v != \"\" {\n    if _, err := strconv.ParseInt(strings.TrimSpace(v), 10, 64); err != nil {\n        return fmt.Errorf(\"invalid LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS %q: %w\", v, err)\n    }\n}","typeGuard":"func validInt64(v string) bool {\n    _, err := strconv.ParseInt(v, 10, 64)\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["Use base-10 integers only: no floats, scientific notation, hex, or underscores.","Check templated/interpolated env values actually resolve (search for \"${\" in rendered manifests).","Keep values well within int64 range for object counts."],"tags":["configuration","env-var","int-parse"],"backgroundTag":"invalid-env-var-value","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}