{"record":{"id":"2accaa2a89c1bcc0","repo":"weaviate/weaviate","slug":"parse-lazy-load-shard-count-threshold-as-int-w","errorCode":null,"errorMessage":"parse LAZY_LOAD_SHARD_COUNT_THRESHOLD as int: %w","messagePattern":"parse LAZY_LOAD_SHARD_COUNT_THRESHOLD as int: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/config/environment.go","lineNumber":162,"sourceCode":"\t\tconfig.TrackVectorDimensionsInterval = DefaultTrackVectorDimensionsInterval\n\t}\n\n\tif entcfg.Enabled(os.Getenv(\"REINDEX_VECTOR_DIMENSIONS_AT_STARTUP\")) {\n\t\tconfig.ReindexVectorDimensionsAtStartup = true\n\t}\n\n\tif entcfg.Enabled(os.Getenv(\"DISABLE_LAZY_LOAD_SHARDS\")) {\n\t\tlogrus.Warn(\"DISABLE_LAZY_LOAD_SHARDS is deprecated and will be removed in a future version. Use LAZY_LOAD_SHARD_COUNT_THRESHOLD instead to configure dynamic lazy load shards if needed, otherwise weaviate will decide based on the shard count and size thresholds.\")\n\t\tv := false\n\t\tconfig.EnableLazyLoadShards = &v\n\t}\n\n\t// Lazy load shard count threshold for auto-detection\n\t// Determines at what shard count auto-detection enables lazy loading\n\tif v := os.Getenv(\"LAZY_LOAD_SHARD_COUNT_THRESHOLD\"); v != \"\" {\n\t\tasInt, err := strconv.Atoi(v)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"parse LAZY_LOAD_SHARD_COUNT_THRESHOLD as int: %w\", err)\n\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 {","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/config/environment.go#L144-L180","documentation":"FromEnv parses LAZY_LOAD_SHARD_COUNT_THRESHOLD with strconv.Atoi to configure the shard count at which lazy shard loading auto-detection kicks in. If the value is not a plain base-10 integer, the Atoi error is wrapped as \"parse LAZY_LOAD_SHARD_COUNT_THRESHOLD as int: %w\" and config loading aborts.","triggerScenarios":"LAZY_LOAD_SHARD_COUNT_THRESHOLD set to a non-integer string such as \"10.5\", \"auto\", \"1,000\", \"0x20\", or a value with units/whitespace (\" 12 \") when FromEnv runs during LoadConfig.","commonSituations":"Copy-pasting a percentage or float from docs; shell/locale formatting with thousand separators; YAML/JSON values in helm charts rendered unquoted into the env; typos like \"12o\".","solutions":["Set the env var to a plain integer, e.g. LAZY_LOAD_SHARD_COUNT_THRESHOLD=100.","Unset it to use the default threshold.","Quote/escape values in helm/compose so no whitespace or units leak in."],"exampleFix":"// before\nLAZY_LOAD_SHARD_COUNT_THRESHOLD=10.5\n// after\nLAZY_LOAD_SHARD_COUNT_THRESHOLD=10","handlingStrategy":"validation","validationCode":"v := os.Getenv(\"LAZY_LOAD_SHARD_COUNT_THRESHOLD\")\nif v != \"\" {\n    n, err := strconv.Atoi(strings.TrimSpace(v))\n    if err != nil || n < 0 {\n        return fmt.Errorf(\"invalid LAZY_LOAD_SHARD_COUNT_THRESHOLD %q\", v)\n    }\n}","typeGuard":"func validInt(v string) bool {\n    _, err := strconv.Atoi(v)\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["Use plain integers without separators, units, or decimals in int env vars.","Quote helm/compose values so no whitespace or formatting leaks in.","Add a config smoke test that runs LoadConfig with your production env file before rollout."],"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"}