xtekky/gpt4free · warning · VersionNotFoundError
Failed to get GitHub release version for '{repo}'
Error message
Failed to get GitHub release version for '{repo}' What it means
The catch-all branch of get_github_version in g4f/version.py wraps any exception raised while fetching https://api.github.com/repos/{repo}/releases/latest — network errors, non-2xx statuses from raise_for_status(), JSON decode errors — into VersionNotFoundError('Failed to get GitHub release version for \'{repo}\''). The inner 'No tag_name' raise is also caught here, so both paths surface with this message.
Source
Thrown at g4f/version.py:62
Raises:
VersionNotFoundError: If there is a network or parsing error.
"""
try:
import requests
response = requests.get(
f"https://api.github.com/repos/{repo}/releases/latest",
timeout=REQUEST_TIMEOUT,
)
response.raise_for_status()
data = response.json()
if "tag_name" not in data:
raise VersionNotFoundError(
f"No tag_name found in latest GitHub release for '{repo}'"
)
return data["tag_name"]
except Exception as e:
raise VersionNotFoundError(
f"Failed to get GitHub release version for '{repo}'"
) from e
def get_git_version() -> str | None:
"""Return latest Git tag if available, else None."""
try:
return check_output(
["git", "describe", "--tags", "--abbrev=0"], text=True, stderr=PIPE
).strip()
except (CalledProcessError, FileNotFoundError):
return None
class VersionUtils:
"""
Utility class for managing and comparing package versions of 'g4f'.
"""View on GitHub (pinned to 973504e177)
Solutions
- Curl the endpoint to see the real cause: curl -i https://api.github.com/repos/<repo>/releases/latest (403 = rate limit, 404 = bad repo)
- If rate-limited, add a GITHUB_TOKEN-authenticated request or check less frequently
- Fix the repo slug if it 404s
- Catch VersionNotFoundError and degrade gracefully to another version source (PyPI/git tags)
Example fix
# before
latest = get_github_version('xtekky/gpt4free')
# after
from g4f.version import get_github_version, VersionNotFoundError
try:
latest = get_github_version('xtekky/gpt4free')
except VersionNotFoundError as e:
latest = None # log e.__cause__ for the underlying reason Defensive patterns
Strategy: try-catch
Validate before calling
import requests
def github_api_ok(repo: str) -> bool:
try:
r = requests.get(
f"https://api.github.com/repos/{repo}/releases/latest", timeout=5
)
return r.status_code == 200
except requests.RequestException:
return False Try / catch
from g4f.version import get_github_version, VersionNotFoundError
try:
v = get_github_version("xtekky/gpt4free")
except VersionNotFoundError as e:
cause = e.__cause__ # requests.HTTPError / ConnectionError — real reason
v = None Prevention
- Authenticate GitHub API calls or check infrequently to avoid 403 rate limits
- Catch VersionNotFoundError around every update check
- Log e.__cause__ to distinguish rate-limit vs network vs parse failures
When it happens
Trigger: Calling get_github_version(repo) when offline, DNS fails, a proxy blocks api.github.com, GitHub returns 403 (rate limit: 60 req/hr unauthenticated) or 404 (wrong repo slug), or the body is not valid JSON.
Common situations: Unauthenticated GitHub API rate limits hit by frequent update checks; CI runners with restricted egress; typos in the repo name; GitHub API outages.
Related errors
- No tag_name found in latest GitHub release for '{repo}'
- Failed to get PyPI version for '{package_name}'
- CDP module is required for Cloudflare provider. Please ensur
- WebSocket Error: {ws.exception()}
- Failed to chat: {response.status} {error_text}
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/5b29f45ceb8c7493.
Report an issue: GitHub.