Troubleshooting¶
Common issues and their solutions.
Authentication Issues¶
Symptom: 401 Unauthorized¶
Causes:
- Invalid GitHub App ID
- Invalid Installation ID
- Invalid or expired private key
- App not installed on organization
Solutions:
- Verify GitHub App credentials:
# Check App ID and Installation ID are numeric
echo $GITHUB_APP_ID
echo $GITHUB_APP_INSTALLATION_ID
# Verify private key format
echo "$GITHUB_APP_PRIVATE_KEY" | head -1
# Should output: -----BEGIN RSA PRIVATE KEY-----
- Verify App installation:
- Go to GitHub → Settings → GitHub Apps
- Check that the app is installed on your organization
-
Verify the Installation ID matches
-
Generate new private key:
- GitHub App settings → Generate new private key
- Update
GITHUB_APP_PRIVATE_KEYenvironment variable
Symptom: 403 Forbidden¶
Causes:
- Insufficient permissions
- Rate limiting
- Repository access denied
Solutions:
- Check GitHub App permissions:
- Repository: Contents (read/write)
- Repository: Pull Requests (read/write)
- Repository: Issues (read/write)
-
Organization: Members (read)
-
Check rate limits:
# View rate limit status in logs
docker-compose logs cookstyle-runner | grep "rate limit"
# Enable caching to reduce API calls
GCR_USE_CACHE=1
GCR_CACHE_MAX_AGE=7
Configuration Issues¶
Symptom: Missing Required Configuration¶
[ERROR] Configuration validation failed:
- github.app_id is required
- destination.repo_owner is required
Solution:
Ensure all required environment variables are set:
# Required variables
GITHUB_APP_ID=123456
GITHUB_APP_INSTALLATION_ID=789012
GITHUB_APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----..."
GCR_DESTINATION_REPO_OWNER=my-org
GCR_DESTINATION_REPO_TOPICS=chef-cookbook
GCR_GIT_EMAIL=bot@example.com
GCR_GIT_NAME=Cookstyle Bot
Symptom: Invalid Configuration Values¶
Solution:
Check data types:
# Must be numeric
GCR_CACHE_MAX_AGE=7 # Not "7 days"
GCR_THREAD_COUNT=4 # Not "four"
# Must be 0 or 1 for booleans
GCR_USE_CACHE=1 # Not "true"
GCR_DEBUG_MODE=0 # Not "false"
Repository Processing Issues¶
Symptom: No Repositories Found¶
Causes:
- No repositories have the specified topics
- GitHub App doesn't have access to repositories
- Wrong organization name
Solutions:
- Verify organization name:
- Check repository topics:
- Go to repositories on GitHub
-
Verify they have the specified topics
-
Use specific repository filter:
Symptom: Repository Clone Failed¶
[ERROR] Failed to clone repository: sous-chefs/apt
fatal: could not read Username for 'https://github.com'
Causes:
- Authentication failure
- Network issues
- Repository doesn't exist
Solutions:
-
Verify authentication (see Authentication Issues above)
-
Check repository exists:
- Check network connectivity:
Symptom: Cookstyle Command Failed¶
Causes:
- Invalid Ruby syntax in target repository
- Cookstyle not installed
- Permission issues
Solutions:
- Enable debug mode:
- Test Cookstyle manually:
# Access container
docker-compose exec cookstyle-runner /bin/bash
# Run Cookstyle
cd /tmp/repos/owner/repo
cookstyle --version
cookstyle -a --format json
Pull Request Issues¶
Symptom: PR Creation Failed¶
Causes:
- Branch already exists
- No changes to commit
- Invalid branch name
- Base branch doesn't exist
Solutions:
- Check if PR already exists:
- Go to repository on GitHub
-
Check for existing PR from the branch
-
Verify branch configuration:
# Check branch names are valid
GCR_BRANCH_NAME=automated/cookstyle # Valid
GCR_DEFAULT_GIT_BRANCH=main # Must exist in repo
- Force refresh to recreate:
Symptom: No PRs Created¶
Causes:
- No offenses found (good!)
- All repositories cached and unchanged
- Cookstyle auto-correction disabled
Solutions:
- Check if offenses exist:
- Force refresh to bypass cache:
- Test specific repository:
Cache Issues¶
Symptom: Cache Not Working¶
[INFO] [1/23] Processing: sous-chefs/apt (not cached)
[INFO] [2/23] Processing: sous-chefs/nginx (not cached)
Causes:
- Cache disabled
- Cache file corrupted
- Cache volume not mounted
Solutions:
- Verify cache is enabled:
- Check cache volume:
# Docker Compose
docker-compose exec cookstyle-runner ls -la /app/.cache/
# Kubernetes
kubectl exec <pod-name> -- ls -la /app/.cache/
- Clear and rebuild cache:
# Remove cache file
docker-compose run --entrypoint rm cookstyle-runner /app/.cache/cache.json
# Run again to rebuild
docker-compose up
Symptom: Stale Cache¶
Causes:
- Cache max age too high
- Repository SHA not updated
Solutions:
- Reduce cache max age:
- Force refresh:
Performance Issues¶
Symptom: Out of Memory (OOMKilled)¶
Solutions:
- Reduce thread count:
- Increase memory limits (Kubernetes):
- Process fewer repositories:
Symptom: Slow Processing¶
Solutions:
- Enable caching:
- Increase thread count:
- Check network latency:
Docker Issues¶
Symptom: Image Pull Failed¶
Solution:
Verify image name and tag:
Symptom: Volume Mount Permission Denied¶
Solution:
Fix volume permissions:
# Create cache directory with correct permissions
mkdir -p /tmp/cookstyle-runner
chmod 777 /tmp/cookstyle-runner
Kubernetes Issues¶
Symptom: CronJob Not Running¶
Solutions:
- Check CronJob schedule:
- Manually trigger job:
- Check events:
Symptom: Pod Fails to Start¶
Solutions:
- Check pod logs:
- Check pod events:
- Verify secrets and configmaps:
Getting Help¶
If you're still experiencing issues:
- Enable debug logging:
- Collect logs:
# Docker Compose
docker-compose logs cookstyle-runner > logs.txt
# Kubernetes
kubectl logs <pod-name> > logs.txt
- Open an issue:
- Go to GitHub Issues
- Include:
- Error message
- Configuration (redact secrets!)
- Logs (redact sensitive data!)
- Environment (Docker/Kubernetes, versions)