sgl-project/sglang · error · ValueError

seed must not exceed the signed int64 maximum, got {normaliz

Error message

seed must not exceed the signed int64 maximum, got {normalized_seed}

What it means

The `seed` field must fit in a signed 64-bit integer because it is forwarded to the sampling backend as int64. Values above MINIMAX_H3_MAX_SIGNED_SEED (2**63 - 1) are rejected before they could overflow downstream.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py:376

        "conditions": normalized_conditions,
        "target": normalized_target,
    }
    normalized_flow_shift = _optional_positive_finite_float(flow_shift, "flow_shift")
    normalized_audio_flow_shift = _optional_positive_finite_float(
        audio_flow_shift, "audio_flow_shift"
    )
    if normalized_flow_shift is not None:
        canonical["flow_shift"] = normalized_flow_shift
    if normalized_audio_flow_shift is not None:
        canonical["audio_flow_shift"] = normalized_audio_flow_shift
    if seed is not None:
        normalized_seed = _require_int(seed, "seed")
        if normalized_seed < 0:
            raise ValueError(f"seed must be non-negative, got {normalized_seed}")
        if normalized_seed > MINIMAX_H3_MAX_SIGNED_SEED:
            raise ValueError(
                f"seed must not exceed the signed int64 maximum, got {normalized_seed}"
            )
        canonical["seed"] = normalized_seed
    return canonical


__all__ = [
    "MINIMAX_H3_REQUEST_SCHEMA",
    "MINIMAX_H3_MAX_SIGNED_SEED",
    "MINIMAX_H3_SUPPORTED_FPS",
    "minimax_h3_validate_canonical_request",
]

View on GitHub (pinned to 0132848349)

Solutions

  1. Mask or modulo the seed into [0, 2**63-1], e.g. seed % (2**63)
  2. Use seeds from random.getrandbits(63) or smaller

Example fix

# before
seed = int(uuid.uuid4().int)
# after
seed = uuid.uuid4().int % (2**63 - 1)
Defensive patterns

Strategy: validation

Validate before calling

def clamp_seed(seed): return None if seed is None else seed % (2**63 - 1)

Type guard

def is_valid_seed(v) -> bool: return v is None or (type(v) is int and 0 <= v <= 2**63 - 1)

Try / catch

null

Prevention

When it happens

Trigger: Calling minimax_h3_validate_canonical_request with seed greater than 9223372036854775807, e.g. a 128-bit UUID-derived integer or a Python arbitrary-precision random value.

Common situations: Deriving seeds from cryptographic hashes/UUIDs without masking; using random.getrandbits(128) as a seed.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/7c8b71f3cdd780df. Report an issue: GitHub.