{"record":{"id":"2d04b9579c2b35be","repo":"XX-net/XX-Net","slug":"get-version-fail","errorCode":null,"errorMessage":"get_version_fail:","messagePattern":"get_version_fail:","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"code/default/launcher/setup.py","lineNumber":66,"sourceCode":"            return True\n        except:\n            xlog.info(\"download %s to %s fail\", url, file)\n            return False\n\n    def get_xxnet_url_version(readme_file):\n\n        try:\n            fd = open(readme_file, \"r\")\n            lines = fd.readlines()\n            p = re.compile(r'https://codeload.github.com/XX-net/XX-Net/zip/([0-9]+)\\.([0-9]+)\\.([0-9]+)')\n            for line in lines:\n                m = p.match(line)\n                if m:\n                    version = m.group(1) + \".\" + m.group(2) + \".\" + m.group(3)\n                    return m.group(0), version\n        except Exception as e:\n            xlog.exception(\"get version fail:%s\", e)\n        raise \"get_version_fail:\" % readme_file\n\n    readme_url = \"https://raw.githubusercontent.com/XX-net/XX-Net/master/README.md\"\n    readme_targe = os.path.join(download_path, \"README.md\")\n    if not os.path.isdir(download_path):\n        os.mkdir(download_path)\n    if not download_file(readme_url, readme_targe):\n        raise \"get README fail:\" + readme_url\n    xxnet_url, xxnet_version = get_xxnet_url_version(readme_targe)\n    xxnet_unzip_path = os.path.join(download_path, \"XX-Net-%s\" % xxnet_version)\n    xxnet_zip_file = os.path.join(download_path, \"XX-Net-%s.zip\" % xxnet_version)\n\n    if not download_file(xxnet_url, xxnet_zip_file):\n        raise \"download xxnet zip fail:\" + download_path\n\n    with zipfile.ZipFile(xxnet_zip_file, \"r\") as dz:\n        dz.extractall(download_path)\n        dz.close()\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/launcher/setup.py#L48-L84","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the downloaded README.md and check it actually contains the XX-Net zip download URL/version line","Make download_file verify HTTP 200 and content type so HTML error pages aren't saved as README","Update the version regex in get_xxnet_url_version to match the current README format","Pin to a known-good release URL instead of scraping the master README"],"exampleFix":"# before\nraise \"get_version_fail:\" % readme_file\n\n# after\nraise RuntimeError(\"get_version_fail:\" % readme_file)","handlingStrategy":"try-catch","validationCode":"content = open(readme_file).read()\nassert 'XX-Net' in content and re.search(r'\\d+\\.\\d+\\.\\d+', content), 'README unusable'","typeGuard":null,"tryCatchPattern":"try:\n    url, ver = get_xxnet_url_version(readme_targe)\nexcept (TypeError, Exception) as e:\n    # string-raise becomes TypeError on py3\n    log_and_fallback_to_pinned_release()","preventionTips":["Verify downloaded content looks like a README before parsing","Pin a known release URL instead of scraping master README","Fix the string raise to RuntimeError"],"tags":["version-parsing","python3","launcher","upstream-change"],"backgroundTag":"raise-string-typeerror","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}