{"record":{"id":"67efb936159c925b","repo":"weaviate/weaviate","slug":"lazy-load-shard-size-threshold-gb-must-be-0","errorCode":null,"errorMessage":"LAZY_LOAD_SHARD_SIZE_THRESHOLD_GB must be >= 0","messagePattern":"LAZY_LOAD_SHARD_SIZE_THRESHOLD_GB must be >= 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/config/environment.go","lineNumber":210,"sourceCode":"\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)\n\t}\n\n\t// Lazy load shard size threshold for auto-detection (in GB)\n\t// Determines at what total shard size auto-detection enables lazy loading\n\tif v := os.Getenv(\"LAZY_LOAD_SHARD_SIZE_THRESHOLD_GB\"); v != \"\" {\n\t\tasFloat, err := strconv.ParseFloat(v, 64)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"parse LAZY_LOAD_SHARD_SIZE_THRESHOLD_GB as float: %w\", err)\n\t\t}\n\t\tif asFloat < 0 {\n\t\t\treturn fmt.Errorf(\"LAZY_LOAD_SHARD_SIZE_THRESHOLD_GB must be >= 0\")\n\t\t}\n\t\tconfig.LazyLoadShardSizeThresholdGB = asFloat\n\t} else {\n\t\tconfig.LazyLoadShardSizeThresholdGB = DefaultLazyLoadShardSizeThresholdGB\n\t}\n\n\tif entcfg.Enabled(os.Getenv(\"FORCE_FULL_REPLICAS_SEARCH\")) {\n\t\tconfig.ForceFullReplicasSearch = true\n\t}\n\n\tif v := os.Getenv(\"TRANSFER_INACTIVITY_TIMEOUT\"); v != \"\" {\n\t\ttimeout, err := time.ParseDuration(v)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"parse TRANSFER_INACTIVITY_TIMEOUT as duration: %w\", err)\n\t\t}\n\t\tconfig.TransferInactivityTimeout = timeout\n\t} else {\n\t\tconfig.TransferInactivityTimeout = DefaultTransferInactivityTimeout","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/config/environment.go#L192-L228","documentation":"After parsing LAZY_LOAD_SHARD_SIZE_THRESHOLD_GB as a float, FromEnv validates it is not negative and returns the literal error \"LAZY_LOAD_SHARD_SIZE_THRESHOLD_GB must be >= 0\" otherwise, aborting startup. A negative size threshold is meaningless for the lazy-load size auto-detection logic.","triggerScenarios":"Set LAZY_LOAD_SHARD_SIZE_THRESHOLD_GB to a negative number such as \"-1\" (e.g. used as a \"disable\" sentinel from other tooling conventions); LoadConfig -> FromEnv returns this error at environment.go:210.","commonSituations":"Operators assuming -1 disables the feature (Go code does not treat it that way); misconfigured arithmetic in provisioning scripts producing negative values.","solutions":["Set a non-negative value, e.g. LAZY_LOAD_SHARD_SIZE_THRESHOLD_GB=0 (0 combined with threshold 0 semantics acts as always-lazy) or a realistic size like 20.","Unset the variable to use the built-in default.","Reject negative values in config linting/CI before deployment."],"exampleFix":"// before\nLAZY_LOAD_SHARD_SIZE_THRESHOLD_GB=-1\n// after\nLAZY_LOAD_SHARD_SIZE_THRESHOLD_GB=20","handlingStrategy":"validation","validationCode":"v := os.Getenv(\"LAZY_LOAD_SHARD_SIZE_THRESHOLD_GB\")\nif v != \"\" {\n    f, err := strconv.ParseFloat(v, 64)\n    if err != nil {\n        return fmt.Errorf(\"not a float: %w\", err)\n    }\n    if f < 0 {\n        return fmt.Errorf(\"LAZY_LOAD_SHARD_SIZE_THRESHOLD_GB must be >= 0, got %v\", f)\n    }\n}","typeGuard":"func validNonNegativeFloat(v string) bool {\n    f, err := strconv.ParseFloat(v, 64)\n    return err == nil && f >= 0\n}","tryCatchPattern":null,"preventionTips":["Do not use negative values as feature-disabling sentinels; unset instead.","Clamp computed thresholds to >= 0 in provisioning scripts.","Add pre-deploy validation for all LAZY_LOAD_* numeric vars."],"tags":["configuration","env-var","validation"],"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"}