tensorflow/models · error · ConfigError

must be between and , got .

Error message

{field_name} must be between {minimum} and {maximum}, got {value!r}.

What it means

A ConfigError from _require_number_in_range: the value parsed as a number but lies outside the inclusive [minimum, maximum] bounds for that field. It fires during load_config/_validate_detection validation of threshold-style fields.

Solutions

  1. Clamp the value into the range shown in the message.
  2. For probability-like fields (e.g. score thresholds) use a value in [0.0, 1.0].
  3. Check for unit mistakes, e.g. percentages (85) instead of fractions (0.85).
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/config_loader.py:303 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24). Data as JSON: /api/errors/16d1157a0b9fb7b0. Report an issue: GitHub.

Appendix: source

Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/config_loader.py:303

  Args:
      value: The value to validate.
      field_name: Field name used in the error message.
      minimum: Inclusive lower bound.
      maximum: Inclusive upper bound.
      allow_int: Whether integer values are acceptable.

  Returns:
      The validated value as a float.

  Raises:
      ConfigError: If the value is not a number or is out of range.
  """
  allowed_types = (int, float) if allow_int else (float,)
  if isinstance(value, bool) or not isinstance(value, allowed_types):
    raise ConfigError(f"{field_name} must be a number, got {value!r}.")
  if not minimum <= value <= maximum:
    raise ConfigError(
        f"{field_name} must be between {minimum} and {maximum}, "
        f"got {value!r}."
    )
  return float(value)


def _require_positive_int(value: Any, field_name: str) -> int:
  """Validates that a value is a positive (non-zero) integer.

  Args:
      value: The value to validate.
      field_name: Field name used in the error message.

  Returns:
      The validated integer.

  Raises:
      ConfigError: If the value is not a positive integer.

View on GitHub (pinned to e006f5f0d5)