{"record":{"id":"5b52abcd930e98c8","repo":"xtekky/gpt4free","slug":"no-tag-name-found-in-latest-github-release-for-r","errorCode":null,"errorMessage":"No tag_name found in latest GitHub release for '{repo}'","messagePattern":"No tag_name found in latest GitHub release for '(.+?)'","errorType":"exception","errorClass":"VersionNotFoundError","httpStatus":null,"severity":"warning","filePath":"g4f/version.py","lineNumber":57,"sourceCode":"@lru_cache(maxsize=1)\ndef get_github_version(repo: str) -> str:\n    \"\"\"\n    Retrieves the latest release version from a GitHub repository.\n\n    Raises:\n        VersionNotFoundError: If there is a network or parsing error.\n    \"\"\"\n    try:\n        import requests\n\n        response = requests.get(\n            f\"https://api.github.com/repos/{repo}/releases/latest\",\n            timeout=REQUEST_TIMEOUT,\n        )\n        response.raise_for_status()\n        data = response.json()\n        if \"tag_name\" not in data:\n            raise VersionNotFoundError(\n                f\"No tag_name found in latest GitHub release for '{repo}'\"\n            )\n        return data[\"tag_name\"]\n    except Exception as e:\n        raise VersionNotFoundError(\n            f\"Failed to get GitHub release version for '{repo}'\"\n        ) from e\n\n\ndef get_git_version() -> str | None:\n    \"\"\"Return latest Git tag if available, else None.\"\"\"\n    try:\n        return check_output(\n            [\"git\", \"describe\", \"--tags\", \"--abbrev=0\"], text=True, stderr=PIPE\n        ).strip()\n    except (CalledProcessError, FileNotFoundError):\n        return None\n","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/version.py#L39-L75","documentation":"get_github_version in g4f/version.py raises VersionNotFoundError with this message when the GitHub API responded successfully (HTTP 2xx) but the JSON body has no 'tag_name' key — i.e. the 'latest release' endpoint returned an object without a release tag. The check happens before the generic except clause rewraps other failures.","triggerScenarios":"Calling get_github_version(repo) (memoized via lru_cache) for a repository whose /releases/latest response lacks tag_name: repos with no published releases can return an empty object, or an API change/HTML error page parsed as JSON without the key.","commonSituations":"Checking a fork or private/renamed repo with zero releases; GitHub returning an unexpected payload during an incident; a custom GITHUB_API base or intercepted connection returning different JSON.","solutions":["Confirm the repo actually has a published (non-prerelease, non-draft) release — create one or use tags instead","Verify the repo slug passed to get_github_version is correct (owner/name)","Catch VersionNotFoundError and treat the GitHub check as optional (fall back to PyPI or git tag versioning)","Note the result is lru_cache'd — restart the process after fixing the repo so a stale failure is not reused"],"exampleFix":"# before\nv = get_github_version('xtekky/gpt4free')  # raises if no tag_name\n\n# after\nfrom g4f.version import get_github_version, VersionNotFoundError\ntry:\n    v = get_github_version('xtekky/gpt4free')\nexcept VersionNotFoundError:\n    v = get_git_version()  # or None","handlingStrategy":"try-catch","validationCode":"import requests\n\ndef github_release_has_tag(repo: str) -> bool:\n    r = requests.get(f\"https://api.github.com/repos/{repo}/releases/latest\", timeout=5)\n    r.raise_for_status()\n    return \"tag_name\" in r.json()","typeGuard":null,"tryCatchPattern":"from g4f.version import get_github_version, VersionNotFoundError\n\ntry:\n    tag = get_github_version(repo)\nexcept VersionNotFoundError:\n    tag = None  # repo may have no releases; fall back to git tags","preventionTips":["Only query repos that publish at least one formal GitHub release","Catch VersionNotFoundError and fall back to PyPI or git-describe versions","Remember results are lru_cache'd per process — retest in a fresh process"],"tags":["network","github-api","version-check","release"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}