XX-net/XX-Net · warning
get_version_fail in update_from_github
Error message
get_version_fail in update_from_github
What it means
current_version() reads version.txt (local or GitHub) and regex-matches an x.y.z pattern; on any read failure or non-match it logs this warning and returns the sentinel string 'get_version_fail'. Callers comparing versions must handle this sentinel.
Source
Thrown at code/default/launcher/update_from_github.py:191
return versions
except Exception as e:
xlog.exception("xxnet_version fail:%r", e)
raise Exception("get_version_fail:%s" % readme_file)
def current_version():
readme_file = os.path.join(root_path, "version.txt")
try:
with open(readme_file) as fd:
content = fd.read()
p = re.compile(r'([0-9]+)\.([0-9]+)\.([0-9]+)')
m = p.match(content)
if m:
version = m.group(1) + "." + m.group(2) + "." + m.group(3)
return version
except:
xlog.warn("get_version_fail in update_from_github")
return "get_version_fail"
def get_github_versions():
readme_url = "https://raw.githubusercontent.com/XX-net/XX-Net/master/code/default/update_v5.txt"
readme_target = os.path.join(download_path, "version.txt")
if not download_file(readme_url, readme_target):
raise IOError("get update file %s fail:" % readme_url)
versions = parse_update_versions(readme_target)
return versions
def get_hash_sum(version):
versions = get_github_versions()
for v in versions:View on GitHub (pinned to cfa5bc17b6)
Solutions
- Check that code/default/update_v5.txt / local version.txt exists and starts with a dotted triplet like 3.13.2.
- Fix network/GitHub access so the version file can be fetched.
- Treat the returned 'get_version_fail' string as a failure in callers instead of comparing it as a version.
- Loosen/anchor the regex if the upstream format changed.
Example fix
// before m = re.compile(r'([0-9]+)\.([0-9]+)\.([0-9]+)').match(content) // after m = re.compile(r'v?(\d+)\.(\d+)\.(\d+)').search(content)
Defensive patterns
Strategy: fallback
Validate before calling
v = current_version()
if v == 'get_version_fail' or not re.match(r'\d+\.\d+\.\d+$', v):
raise RuntimeError('cannot determine current version') Type guard
def is_version(s):
return bool(re.match(r'^\d+\.\d+\.\d+$', s or '')) Prevention
- Never compare 'get_version_fail' against version tuples.
- Keep version.txt present and readable.
- Test GitHub reachability before update flows.
When it happens
Trigger: version.txt missing/unreadable, network failure fetching the GitHub version file, or content not matching ([0-9]+)\.([0-9]+)\.([0-9]+) at the string start.
Common situations: First run without version.txt; offline machine; GitHub blocked; version file format changed (e.g. leading 'v' or extra text before the numbers).
Related errors
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/f21bf1ac9e9e2a61.
Report an issue: GitHub.