{"record":{"id":"8800c8dd95727797","repo":"SeleniumHQ/selenium","slug":"requested-docfx-version-explicit-version-r-not-f","errorCode":null,"errorMessage":"Requested DocFX version {explicit_version!r} not found in NuGet index","messagePattern":"Requested DocFX version (.+?) not found in NuGet index","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/update_docfx.py","lineNumber":31,"sourceCode":"\nimport urllib3\nfrom packaging.version import InvalidVersion, Version\n\nNUGET_INDEX_URL = \"https://api.nuget.org/v3-flatcontainer/docfx/index.json\"\nNUGET_NUPKG_URL = \"https://api.nuget.org/v3-flatcontainer/docfx/{version}/docfx.{version}.nupkg\"\n\nhttp = urllib3.PoolManager()\n\n\ndef fetch_json(url):\n    r = http.request(\"GET\", url)\n    return json.loads(r.data)\n\n\ndef choose_version(versions, allow_prerelease, explicit_version=None):\n    if explicit_version:\n        if explicit_version not in versions:\n            raise ValueError(f\"Requested DocFX version {explicit_version!r} not found in NuGet index\")\n        return explicit_version\n\n    parsed = []\n    for v in versions:\n        try:\n            pv = Version(v)\n        except InvalidVersion:\n            continue\n        if not allow_prerelease and pv.is_prerelease:\n            continue\n        parsed.append((pv, v))\n\n    if not parsed:\n        if allow_prerelease:\n            raise ValueError(\"No parseable DocFX versions found in NuGet index\")\n        else:\n            raise ValueError(\"No stable DocFX versions found. Use --allow-prerelease to include prereleases.\")\n","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/scripts/update_docfx.py#L13-L49","documentation":"Thrown by choose_version() in scripts/update_docfx.py when the --version flag specifies a DocFX release that does not exist in the NuGet flat-container index (NUGET_INDEX_URL). The script fetches the full version list from NuGet and, before accepting the user-supplied version, verifies it is present in that list. A mismatch means the string (including any pre-release suffix) was never published to NuGet under the 'docfx' package id.","triggerScenarios":"Running `python scripts/update_docfx.py --version X.Y.Z` where X.Y.Z is not in the index. Fetching the index succeeds (a JSON object with a non-empty 'versions' array), but the explicit_version string does not exact-match any entry. Common triggers: a typo, a wrong pre-release suffix, or requesting a version that was yanked/never published.","commonSituations":"A maintainer pins DocFX to a specific release to reproduce a doc bug, mistyping the number; CI reruns an old job after DocFX yanked a release; someone copies a version from an outdated blog post that does not exist on NuGet.","solutions":["Verify the version string against the live index: open https://api.nuget.org/v3-flatcontainer/docfx/index.json and copy an exact value from its 'versions' array.","Remove the --version flag to let the script auto-select the latest stable release.","If you need a pre-release, confirm the exact suffix (e.g. -preview.123) matches the index character-for-character.","Re-run with the corrected version string."],"exampleFix":"# before\npython scripts/update_docfx.py --version 2.99.0\n\n# after\npython scripts/update_docfx.py --version 2.78.2","handlingStrategy":"validation","validationCode":"# Validate --version against the live index before calling choose_version\nimport urllib3, json\nfrom packaging.version import Version\n\nhttp = urllib3.PoolManager()\nindex = json.loads(http.request(\"GET\", \"https://api.nuget.org/v3-flatcontainer/docfx/index.json\").data)\navailable = set(index.get(\"versions\", []))\nrequested = \"2.78.2\"\nif requested not in available:\n    raise SystemExit(f\"{requested!r} not published. Pick from: {sorted(available)[-5:]}\")","typeGuard":null,"tryCatchPattern":"try:\n    version = choose_version(versions, args.allow_prerelease, args.version)\nexcept ValueError as e:\n    print(f\"Version selection failed: {e}\", file=sys.stderr)\n    print(\"Check https://api.nuget.org/v3-flatcontainer/docfx/index.json\", file=sys.stderr)\n    sys.exit(1)","preventionTips":["Always copy the version string verbatim from the NuGet index JSON.","Run without --version for the latest stable to avoid typos.","In CI, fetch the index programmatically and assert membership before pinning."],"tags":["python","build-script","versioning","nuget","validation"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}