weaviate/weaviate · error

int greater than 0 expected, got %v

Error message

int greater than 0 expected, got %v

What it means

ValidateIntGreaterThan0 in usecases/config/parser/validation.go requires a strictly positive integer and returns this error for 0 or negatives. It is typically consumed via ParseDynamicIntWithValidation, producing messages like "<ENV_VAR>: int greater than 0 expected, got <v>".

Source

Thrown at usecases/config/parser/validation.go:39

func ValidateFloatGreaterThan0(val float64) error {
	if val > 0 {
		return nil
	}
	return fmt.Errorf("float greater than 0 expected, got %v", val)
}

func ValidateFloatGreaterThanEqual0(val float64) error {
	if val >= 0 {
		return nil
	}
	return fmt.Errorf("float greater than equal 0 expected, got %v", val)
}

func ValidateIntGreaterThan0(val int) error {
	if val > 0 {
		return nil
	}
	return fmt.Errorf("int greater than 0 expected, got %v", val)
}

func ValidateIntGreaterThanEqual0(val int) error {
	if val >= 0 {
		return nil
	}
	return fmt.Errorf("int greater than equal 0 expected, got %v", val)
}

func ValidateDurationGreaterThan0(val time.Duration) error {
	if val > 0 {
		return nil
	}
	return fmt.Errorf("duration greater than 0 expected, got %v", val)
}

func ValidateDurationGreaterThanEqual0(val time.Duration) error {
	if val >= 0 {

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Set the env var to a positive integer (>= 1)
  2. Unset it to fall back to the validated default
  3. If 0 should mean 'auto', check the setting's docs for a dedicated sentinel value or a GreaterThanEqual0-validated alternative
  4. Quote-check manifests so empty strings don't coerce to 0

Example fix

// before
WORKER_COUNT=0
// after
WORKER_COUNT=4
Defensive patterns

Strategy: validation

Validate before calling

func validatePositiveInt(name string) error {
    v, err := strconv.Atoi(os.Getenv(name))
    if err != nil || v <= 0 {
        return fmt.Errorf("%s must be an int > 0, got %q", name, os.Getenv(name))
    }
    return nil
}

Prevention

When it happens

Trigger: Setting a count-like env var (workers, ports, limits, shard counts) parsed with this validator to 0 or a negative number, e.g. TRACKED_LIMIT=0.

Common situations: Using 0 to mean 'unlimited/auto' when the validator requires >=1; string-to-int coercion of "" or "null" to 0; miscounted arithmetic in deployment scripts.

Related errors


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