weaviate/weaviate · error

parse LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS as int: %w

Error message

parse LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS as int: %w

What it means

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.

Source

Thrown at usecases/config/environment.go:181

		}
		if asInt < 0 {
			return fmt.Errorf("LAZY_LOAD_SHARD_COUNT_THRESHOLD must be >= 0")
		}
		config.LazyLoadShardCountThreshold = asInt
		if config.LazyLoadShardCountThreshold == 0 {
			v := true
			config.EnableLazyLoadShards = &v
		}
	} else {
		config.LazyLoadShardCountThreshold = DefaultLazyLoadShardCountThreshold
	}

	// Written only when the variable is set, so a value from the config file
	// survives.
	if v := os.Getenv("LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS"); v != "" {
		asInt, err := strconv.ParseInt(v, 10, 64)
		if err != nil {
			return fmt.Errorf("parse LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS as int: %w", err)
		}
		config.LazyLoadShardWarmupMinObjects = asInt
	}
	// Eager loading ignores the knob entirely, so warning there would describe a
	// state no collection on this node is in. Auto-detection is resolved per
	// collection later, so a nil setting still warns.
	if minObjects := config.LazyLoadShardWarmupMinObjects; minObjects != 0 &&
		(config.EnableLazyLoadShards == nil || *config.EnableLazyLoadShards) {
		left := fmt.Sprintf("only shards holding more than %d objects are warmed up", minObjects)
		if minObjects < 0 {
			left = "no shard is warmed up"
		}
		logrus.Warnf("LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS is %d, so on a collection using lazy loading %s. "+
			"A HOT tenant left out stays unloaded until first access. "+
			"While it is unloaded the TTL sweep keeps its expired objects, async replication leaves a "+
			"stale replica unrepaired, and MAXIMUM_ALLOWED_OBJECTS_COUNT stops counting it, so this "+
			"node admits writes past its cap.",
			minObjects, left)

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Set the variable to a plain base-10 integer, e.g. LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS=10000.
  2. Unset the variable to keep the default warmup threshold.
  3. Fix templating/secret-substitution so the raw placeholder is not passed through to the container.

Example fix

// before
LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS=1e6
// after
LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS=1000000
Defensive patterns

Strategy: validation

Validate before calling

v := os.Getenv("LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS")
if v != "" {
    if _, err := strconv.ParseInt(strings.TrimSpace(v), 10, 64); err != nil {
        return fmt.Errorf("invalid LAZY_LOAD_SHARD_WARMUP_MIN_OBJECTS %q: %w", v, err)
    }
}

Type guard

func validInt64(v string) bool {
    _, err := strconv.ParseInt(v, 10, 64)
    return err == nil
}

Prevention

When it happens

Trigger: 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.

Common situations: Values copied from JSON/YAML configs that used floats; a value like "10000000000000000000" (> int64 max); templating errors leaving "${...}" unresolved in the env value.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/f16c076db34ffc31. Report an issue: GitHub.