-
Couldn't load subscription status.
- Fork 0
Troubleshooting
Garot Conklin edited this page Oct 10, 2025
·
2 revisions
This guide covers common issues you might encounter when using githubauthlib and their solutions.
-
TokenNotFoundErroris raised - "GitHub access token not found" error message
- Git credentials not configured
- Token not stored in system keychain
- Token stored with incorrect protocol/host
- Verify Git credentials are configured:
# Check Git configuration
git config --global credential.helper
# macOS
git config --global credential.helper osxkeychain
# Windows
git config --global credential.helper manager
# Linux
git config --global credential.helper libsecret- Store credentials manually:
# This will prompt for your credentials
git credential-osxkeychain store
protocol=https
host=github.com
username=your-username
password=ghp_your_token-
CredentialHelperErroris raised - "Permission denied" or similar error message
- Insufficient permissions for keychain access
- System keychain locked
- Application not trusted by system
- Open Keychain Access
- Find the GitHub entry
- Update permissions for the credential
- Open Credential Manager
- Check Generic Credentials
- Verify GitHub credentials exist
- Check libsecret installation:
which secret-tool- Test libsecret access:
secret-tool lookup host github.com-
PlatformNotSupportedErroris raised - "Unsupported operating system" message
-
Verify your operating system is supported:
- macOS
- Windows
- Linux
-
Check platform-specific dependencies:
# Linux
sudo apt-get install libsecret-tools # Ubuntu/Debian
sudo dnf install libsecret # Fedora
sudo pacman -S libsecret # Arch Linux-
InvalidTokenErroris raised - "Invalid token format" error message
-
Verify token format:
- Personal tokens:
ghp_prefix followed by 36+ characters - Organization tokens:
gho_prefix followed by 36+ characters - Fine-grained tokens:
github_pat_prefix followed by 60+ characters
- Personal tokens:
-
Generate a new token:
- Go to GitHub Settings > Developer settings > Personal access tokens
- Generate new token
- Store token securely
ModuleNotFoundErrorImportError
- Verify installation:
pip list | grep githubauthlib- Reinstall package:
pip uninstall githubauthlib
pip install githubauthlib- Check Python version:
python --version # Should be 3.9 or higher- No log output
- Insufficient log information
- Configure logging:
import logging
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)- Enable debug logging for the library:
logging.getLogger('githubauthlib').setLevel(logging.DEBUG)# Python version
python --version
# Installed packages
pip freeze
# Operating system
python -c "import platform; print(platform.system())"# Check Git version
git --version
# List Git configuration
git config --list
# Test Git credential helper
git credential fill <<EOF
protocol=https
host=github.com
EOFsecurity find-generic-password -s github.comcmdkey /list | findstr github.comsecret-tool search host github.comIf you're still experiencing issues:
- Enable debug logging and collect logs
- Check the GitHub Issues
- Create a new issue with:
- Operating system and version
- Python version
- Installation method
- Error messages
- Steps to reproduce
- Debug logs (with sensitive information removed)
try:
token = get_github_token()
except CredentialHelperError as e:
if "not found" in str(e):
print("Credential helper not configured")
elif "permission denied" in str(e):
print("Permission issues with credential helper")
else:
print(f"Unknown credential helper error: {e}")try:
token = get_github_token()
except PlatformNotSupportedError as e:
print(f"System not supported: {platform.system()}")try:
token = get_github_token()
except InvalidTokenError as e:
print("Token format is invalid")
print("Supported formats: ghp_, gho_, github_pat_")try:
token = get_github_token()
except TokenNotFoundError as e:
print("No token found in system keychain")
print("Configure Git credentials first")- Token retrieval takes more than 1 second
- System appears to hang
- Cache the token:
from functools import lru_cache
@lru_cache(maxsize=1)
def get_cached_token():
return get_github_token()- Check system keychain performance:
- Remove unused credentials
- Update system keychain software
- Check system resources
- Never log tokens
- Use environment variables when needed
- Rotate tokens regularly
- Use fine-grained tokens
- Set appropriate token permissions
For security-related issues:
- DO NOT create a public issue
- Email [email protected]
- Include detailed information
- Follow responsible disclosure