What happened?
Hello,
First, thank you to all the contributors for making available this great script!
For the past few days, even though I do have the rights, I've been regularly getting random 401 Unauthorized causing the backup to stop:
2026-07-10T10:11:03.506: Requesting https://api.github.com/repos/myorg/myproj/issues/80/events?per_page=100
2026-07-10T10:11:03.736: API Error: 401 Unauthorized for https://api.github.com/repos/myorg/myproj/issues/80/events?per_page=100
Traceback (most recent call last): File "/app/.venv/bin/github-backup", line 10, in <module> sys.exit(main())
^^^^^^
File "/app/.venv/lib/python3.12/site-packages/github_backup/cli.py", line 83, in main
backup_repositories(args, output_directory, repositories)
File "/app/.venv/lib/python3.12/site-packages/github_backup/github_backup.py", line 2137, in backup_repositories
backup_issues(args, repo_cwd, repository, repos_template)
File "/app/.venv/lib/python3.12/site-packages/github_backup/github_backup.py", line 2559, in backup_issues
issues[number]["event_data"] = retrieve_data(args, template)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/github_backup/github_backup.py", line 856, in retrieve_data
return list(fetch_all())
^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/github_backup/github_backup.py", line 759, in fetch_all
http_response = make_request_with_retry(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/github_backup/github_backup.py", line 954, in make_request_with_retry
return urlopen(request, context=https_ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/urllib/request.py", line 215, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/urllib/request.py", line 521, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/urllib/request.py", line 630, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/urllib/request.py", line 559, in error
return self._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/urllib/request.py", line 492, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/usr/local/lib/python3.12/urllib/request.py", line 639, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 401: Unauthorized
I added the status 401 in the retryable status_code and it seems to fix the problem but not sure if this is the recommended way.
2026-07-10T12:01:01.626: Requesting https://api.github.com/repos/myorg/myproj/issues/310/events?per_page=100
2026-07-10T12:01:01.895: HTTP 401 (Unauthorized), retrying in 1.1s (attempt 1/6) for https://api.github.com/repos/myorg/myproj/issues/310/events?per_page=100 │
2026-07-10T12:01:03.625: Requesting https://api.github.com/repos/myorg/myproj/issues/309/comments?per_page=100
What happened?
Hello,
First, thank you to all the contributors for making available this great script!
For the past few days, even though I do have the rights, I've been regularly getting random
401 Unauthorizedcausing the backup to stop:I added the status 401 in the retryable status_code and it seems to fix the problem but not sure if this is the recommended way.