[Bugfix][CI/Build] Fail closed when selected precompiled CUDA variant is unavailable (#52545)

Signed-off-by: Jung Jiyu <jiyu.jung@navercorp.com>

Jung Jiyu committed Aug 28, 2026 at 18:00 UTC 3bb19cd8a32f9cd25f04883028ab3dc719f3edab
2 files changed +13 -21
docs/contributing/ci/nightly_builds.md
+2 -2
@@ -134,9 +134,9 @@ When installing vLLM with `VLLM_USE_PRECOMPILED=1`, the `setup.py` script:
134
135 1. **Determines wheel location** via `precompiled_wheel_utils.determine_wheel_url()`:
136 - Env var `VLLM_PRECOMPILED_WHEEL_LOCATION` (user-specified URL/path) always takes precedence and skips all other steps.
137 - - Determines the variant from `VLLM_MAIN_CUDA_VERSION` (can be overridden with env var `VLLM_PRECOMPILED_WHEEL_VARIANT`); the default variant will also be tried as a fallback.
137 + - For CUDA, uses `VLLM_PRECOMPILED_WHEEL_VARIANT` when specified. Otherwise, an explicitly set `VLLM_MAIN_CUDA_VERSION` selects the variant; if unset, the CUDA version is detected from PyTorch or nvidia-smi, with the default `VLLM_MAIN_CUDA_VERSION` used if detection fails.
138 - Determines the _base commit_ (explained later) of this branch (can be overridden with env var `VLLM_PRECOMPILED_WHEEL_COMMIT`).
139 -2. **Fetches metadata** from `https://wheels.vllm.ai/{commit}/vllm/metadata.json` (for the default variant) or `https://wheels.vllm.ai/{commit}/{variant}/vllm/metadata.json` (for a specific variant).
139 +2. **For CUDA, fetches metadata** for the selected variant from `https://wheels.vllm.ai/{commit}/{variant}/vllm/metadata.json`.
140 3. **Selects compatible wheel** based on:
141 - Package name (`vllm`)
142 - Platform tag (architecture match)
setup.py
+11 -19
@@ -892,8 +892,7 @@ class precompiled_wheel_utils:
892 1. user-specified wheel location (can be either local or remote, via
893 VLLM_PRECOMPILED_WHEEL_LOCATION)
894 2. user-specified variant (VLLM_PRECOMPILED_WHEEL_VARIANT) from nightly repo
895 - or auto-detected CUDA variant based on system (torch, nvidia-smi)
896 - 3. the default variant from nightly repo
895 + or CUDA variant selected from VLLM_MAIN_CUDA_VERSION, torch, or nvidia-smi
896
897 If downloading from the nightly repo, the commit can be specified via
898 VLLM_PRECOMPILED_WHEEL_COMMIT; otherwise, the head commit in the main branch
@@ -924,28 +923,21 @@ class precompiled_wheel_utils:
923 )
924 commit = precompiled_wheel_utils.get_base_commit_in_main_branch()
925 print(f"Using precompiled wheel commit {commit} with variant {variant}")
927 - try_default = False
928 - wheels, repo_url, download_filename = None, None, None
926 + download_filename = None
927 try:
928 wheels, repo_url = precompiled_wheel_utils.fetch_metadata_for_variant(
929 commit, variant
930 )
931 except Exception as e:
934 - logger.warning(
935 - "Failed to fetch precompiled wheel metadata for variant %s: %s",
936 - variant,
937 - e,
938 - )
939 - try_default = True # try outside handler to keep the stacktrace simple
940 - if try_default:
941 - print("Trying the default variant from remote")
942 - wheels, repo_url = precompiled_wheel_utils.fetch_metadata_for_variant(
943 - commit, None
944 - )
945 - # if this also fails, then we have nothing more to try / cache
946 - assert wheels is not None and repo_url is not None, (
947 - "Failed to fetch precompiled wheel metadata"
948 - )
932 + raise RuntimeError(
933 + "Failed to fetch precompiled wheel metadata for CUDA "
934 + f"variant {variant!r} at commit {commit}. The "
935 + "root/default variant is not used as a fallback because "
936 + "its CUDA compatibility with the selected variant cannot "
937 + "be verified. Provide a compatible wheel with "
938 + "VLLM_PRECOMPILED_WHEEL_LOCATION or disable "
939 + "VLLM_USE_PRECOMPILED to build from source."
940 + ) from e
941 # The metadata.json has the following format:
942 # see .buildkite/scripts/generate-nightly-index.py for details
943 """[{