Common issues and solutions for GitHub Utilities toolkit.
Run this diagnostic script to identify common issues:
# Navigate to your github-utilities directory
cd github-utilities
# Run diagnostic checks
echo "π GitHub Utilities Diagnostics"
echo "==============================="
# Check Python version
echo "Python: $(python3 --version 2>/dev/null || echo 'Not found')"
# Check dependencies
echo "Dependencies:"
pip list | grep -E "(requests|python-dotenv)" || echo "Missing dependencies"
# Check environment
echo "Environment:"
python3 -c "
import os
from dotenv import load_dotenv
load_dotenv()
token = os.getenv('GITHUB_TOKEN')
print(f' GITHUB_TOKEN: {\"Set\" if token else \"Not set\"} ({len(token) if token else 0} chars)')
"
# Check Git config
echo "Git config:"
echo " Name: $(git config --global user.name || echo 'Not set')"
echo " Email: $(git config --global user.email || echo 'Not set')"Error: 401 Client Error: Unauthorized for url: https://api.github.com/repos/...Solutions:
-
Check token validity:
curl -H "Authorization: token YOUR_TOKEN" https://api.github.com/user -
Verify .env file:
cat .env | grep GITHUB_TOKEN # Should show: GITHUB_TOKEN=your_token_here
-
Regenerate token:
- Go to GitHub Settings β Tokens
- Delete old token, create new one with
reposcope
β GITHUB_TOKEN not set. Please set it in .env file or environment variable.Solutions:
-
Create .env file:
echo "GITHUB_TOKEN=your_token_here" > .env
-
Check file location:
# .env should be in the same directory as the script ls -la .env -
Export manually:
export GITHUB_TOKEN="your_token_here"
Error: 404 Client Error: Not Found for url: https://api.github.com/repos/owner/repoSolutions:
-
Verify repository details:
# Check if repository exists and is accessible curl -H "Authorization: token YOUR_TOKEN" \ https://api.github.com/repos/OWNER/REPO
-
Check repository name:
- Ensure correct spelling:
owner/repository-name - Check if repository is private (requires appropriate token scopes)
- Ensure correct spelling:
-
Verify token scopes:
- Token needs
reposcope for private repositories - Token needs
public_reposcope for public repositories
- Token needs
Error: 403 Client Error: Forbidden - Resource not accessible by personal access tokenSolutions:
-
Add required scopes to token:
- Go to GitHub Settings β Tokens
- Edit token and add
reposcope
-
Check organization restrictions:
- Some organizations require token approval
- Contact organization admin if needed
ModuleNotFoundError: No module named 'requests'Solutions:
-
Install dependencies:
pip install -r requirements.txt
-
Check Python environment:
# Make sure you're using the right Python which python3 python3 -m pip install requests python-dotenv -
Use virtual environment:
python3 -m venv venv source venv/bin/activate # Linux/macOS # venv\Scripts\activate # Windows pip install -r requirements.txt
PermissionError: [Errno 13] Permission deniedSolutions:
-
Use user installation:
pip install --user -r requirements.txt
-
Fix file permissions:
chmod +x scripts/setup.sh
-
Use virtual environment:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
JSONDecodeError: Expecting ',' delimiter: line 5 column 1Solutions:
-
Validate JSON syntax:
python3 -m json.tool config-examples/basic-config.json
-
Common JSON fixes:
- Remove trailing commas
- Use double quotes, not single quotes
- Escape special characters properly
-
Use provided examples:
cp config-examples/basic-config.json my-config.json # Edit my-config.json carefully
FileNotFoundError: [Errno 2] No such file or directory: 'items.txt'Solutions:
-
Check file path:
ls -la items.txt # Use absolute path if needed python3 github-issue-creator.py --file /full/path/to/items.txt -
Verify working directory:
pwd # Should be in the correct tool directory
Error: 403 Client Error: Forbidden - API rate limit exceededSolutions:
-
Check rate limit status:
curl -H "Authorization: token YOUR_TOKEN" \ https://api.github.com/rate_limit -
Wait for reset:
- Authenticated: 5000 requests/hour
- Unauthenticated: 60 requests/hour
- Wait for
X-RateLimit-Resettime
-
Use smaller batches:
# Process items in smaller batches python3 github-issue-creator.py --file small-batch.txt
β οΈ Git not fully configuredSolutions:
git config --global user.name "Your Name"
git config --global user.email "your@email.com"To get started with GitHub CLI, please run: gh auth loginSolutions:
gh auth login
# Follow the prompts to authenticate# Add to your script for verbose output
export DEBUG=1
python3 github-issue-creator.py --config config.json --file items.txt# Basic API test
curl -H "Authorization: token YOUR_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user
# Test repository access
curl -H "Authorization: token YOUR_TOKEN" \
https://api.github.com/repos/OWNER/REPO# Test GitHub connectivity
ping github.com
# Test API endpoint
curl -I https://api.github.comBefore reporting issues, verify:
- Python 3.7+ installed
- Dependencies installed (
pip install -r requirements.txt) - GitHub token created with correct scopes
- Environment variable set (
GITHUB_TOKEN) - Repository exists and is accessible
- Network connection to github.com
- Git configured (name and email)
- JSON configuration files are valid
- Run the diagnostic script above
- Check this troubleshooting guide
- Search existing GitHub Issues
Include this information:
# System information
echo "OS: $(uname -s)"
echo "Python: $(python3 --version)"
echo "Tool: $(basename $PWD)"
# Error details
echo "Error message: [paste full error]"
echo "Command run: [paste exact command]"
echo "Expected: [describe expected behavior]"
echo "Actual: [describe what happened]"- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - Questions and community help
- Documentation - Complete usage guides
- GitHub API Documentation
- Personal Access Token Guide
- Python Requests Documentation
- JSON Syntax Guide
π οΈ Most issues are resolved by checking authentication and dependencies!