SeleniumHQ/selenium · error · ValueError

No parseable DocFX versions found in NuGet index

Error message

No parseable DocFX versions found in NuGet index

What it means

Raised in choose_version() when --allow-prerelease is enabled yet every version in the NuGet index failed to parse via packaging.Version (InvalidVersion). It indicates the entire published list is structurally unparseable by PEP 440, which should not happen for a real package but guards against corrupted or schema-changed indexes.

Source

Thrown at scripts/update_docfx.py:46

def choose_version(versions, allow_prerelease, explicit_version=None):
    if explicit_version:
        if explicit_version not in versions:
            raise ValueError(f"Requested DocFX version {explicit_version!r} not found in NuGet index")
        return explicit_version

    parsed = []
    for v in versions:
        try:
            pv = Version(v)
        except InvalidVersion:
            continue
        if not allow_prerelease and pv.is_prerelease:
            continue
        parsed.append((pv, v))

    if not parsed:
        if allow_prerelease:
            raise ValueError("No parseable DocFX versions found in NuGet index")
        else:
            raise ValueError("No stable DocFX versions found. Use --allow-prerelease to include prereleases.")

    return max(parsed, key=lambda item: item[0])[1]


def sha256_of_url(url):
    digest = hashlib.sha256()
    r = http.request("GET", url, preload_content=False)
    for chunk in r.stream(1024 * 1024):
        digest.update(chunk)
    r.release_conn()
    return digest.hexdigest()


def render_docfx_repo(version, sha256):
    return f'''\
"""Repository rule to download the docfx NuGet package."""

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Manually inspect the fetched index: `curl -s https://api.nuget.org/v3-flatcontainer/docfx/index.json | python -m json.tool` and check the shape of the 'versions' array.
  2. If the index structure changed, update fetch_json/choose_version to match the new schema.
  3. Retry without --allow-prerelease to see if error 302 also fires (confirming a parse problem rather than a pre-release-only situation).
  4. Report the schema change upstream if the index is genuinely malformed.
Defensive patterns

Strategy: validation

Validate before calling

# Sanity-check that the index contains at least one PEP 440 version
from packaging.version import Version, InvalidVersion
parseable = [v for v in versions if _is_valid(Version, v)]
if args.allow_prerelease and not parseable:
    raise SystemExit("Index has no PEP 440 versions; schema may have changed")

Try / catch

try:
    version = choose_version(versions, args.allow_prerelease, args.version)
except ValueError as e:
    if "No parseable" in str(e):
        # Dump the raw index shape for diagnosis
        print(json.dumps(index, indent=2)[:2000], file=sys.stderr)
    raise

Prevention

When it happens

Trigger: Calling `python scripts/update_docfx.py --allow-prerelease` and the loop at line 34-42 appends nothing because every version string raises InvalidVersion. The index was fetched (non-empty) but no entry conformed to PEP 440.

Common situations: NuGet changes its index schema so 'versions' contains objects instead of plain strings; a mirror/CDN returns an HTML error page that json.loads turned into unexpected structures; an experimental DocFX fork publishes non-PEP440 tags.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/3179ba5dd83be635. Report an issue: GitHub.