XX-net/XX-Net · error

get_version_fail:

Error message

get_version_fail:

What it means

In launcher/setup.py, after failing to parse a version string out of the downloaded README.md, the code executes `raise "get_version_fail:" % readme_file` — raising a string. In Python 3 this is a TypeError ('exceptions must derive from BaseException'); in Python 2 it raised the string itself. Either way it means the README did not contain a recognizable 'XX-Net version x.y.z' download link pattern.

Source

Thrown at code/default/launcher/setup.py:66

            return True
        except:
            xlog.info("download %s to %s fail", url, file)
            return False

    def get_xxnet_url_version(readme_file):

        try:
            fd = open(readme_file, "r")
            lines = fd.readlines()
            p = re.compile(r'https://codeload.github.com/XX-net/XX-Net/zip/([0-9]+)\.([0-9]+)\.([0-9]+)')
            for line in lines:
                m = p.match(line)
                if m:
                    version = m.group(1) + "." + m.group(2) + "." + m.group(3)
                    return m.group(0), version
        except Exception as e:
            xlog.exception("get version fail:%s", e)
        raise "get_version_fail:" % readme_file

    readme_url = "https://raw.githubusercontent.com/XX-net/XX-Net/master/README.md"
    readme_targe = os.path.join(download_path, "README.md")
    if not os.path.isdir(download_path):
        os.mkdir(download_path)
    if not download_file(readme_url, readme_targe):
        raise "get README fail:" + readme_url
    xxnet_url, xxnet_version = get_xxnet_url_version(readme_targe)
    xxnet_unzip_path = os.path.join(download_path, "XX-Net-%s" % xxnet_version)
    xxnet_zip_file = os.path.join(download_path, "XX-Net-%s.zip" % xxnet_version)

    if not download_file(xxnet_url, xxnet_zip_file):
        raise "download xxnet zip fail:" + download_path

    with zipfile.ZipFile(xxnet_zip_file, "r") as dz:
        dz.extractall(download_path)
        dz.close()

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Open the downloaded README.md and check it actually contains the XX-Net zip download URL/version line
  2. Make download_file verify HTTP 200 and content type so HTML error pages aren't saved as README
  3. Update the version regex in get_xxnet_url_version to match the current README format
  4. Pin to a known-good release URL instead of scraping the master README

Example fix

# before
raise "get_version_fail:" % readme_file

# after
raise RuntimeError("get_version_fail:" % readme_file)
Defensive patterns

Strategy: try-catch

Validate before calling

content = open(readme_file).read()
assert 'XX-Net' in content and re.search(r'\d+\.\d+\.\d+', content), 'README unusable'

Try / catch

try:
    url, ver = get_xxnet_url_version(readme_targe)
except (TypeError, Exception) as e:
    # string-raise becomes TypeError on py3
    log_and_fallback_to_pinned_release()

Prevention

When it happens

Trigger: get_XXNet downloads README.md from the XX-net GitHub master branch, then get_xxnet_url_version cannot match the version regex against any line — e.g. upstream README format changed or an error page was saved instead.

Common situations: Upstream README.md restructured so the version regex no longer matches; GitHub returned HTML (rate limit/block page) saved as README.md; running an outdated launcher against a changed upstream layout.

Related errors


AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27). Data as JSON: /api/errors/2d04b9579c2b35be. Report an issue: GitHub.