Comprehensive troubleshooting guide for diagnosing and fixing PR creation issues. SECTIONS: - Step-by-step debugging process - Console log interpretation - Remote URL verification - Credential setup guides - Common error messages and fixes - Manual API testing instructions - Best practices - Quick checklist COVERS: - GitHub vs GitLab detection - Credential matching issues - Token permission problems - URL format validation - API error diagnosis Helps users resolve the "Failed to get GitLab Project: 401" error and similar issues by systematically checking each potential cause.
7.3 KiB
Pull Request Troubleshooting Guide
🔍 Debugging PR Creation Issues
When pull request creation fails, follow these steps to diagnose and fix the issue.
Step 1: Check Browser Console
Open the browser console (F12 → Console tab) and look for logs when creating a PR:
What to Look For:
Parsing remote URL: <your-url>
Detected GitHub HTTPS: { owner: '...', repo: '...' }
Creating PR for: { owner, repo, platform, apiUrl }
Found credentials: Yes/No
Creating github PR...
GitHub PR URL: https://api.github.com/repos/...
Common Console Messages:
✅ Good:
Detected GitHub HTTPS: { owner: 'user', repo: 'myrepo' }
Found credentials: Yes
GitHub response status: 201
GitHub PR created: https://github.com/user/myrepo/pull/123
❌ Problem: Wrong Platform:
Detected GitLab HTTPS: { owner: 'user', repo: 'myrepo' }
Failed to get GitLab project: 401
→ Fix: Your GitHub URL is being detected as GitLab. Check URL format.
❌ Problem: No Credentials:
Found credentials: No
Error: No credentials found for GitHub
→ Fix: Add GitHub credentials in Settings → Git
❌ Problem: Bad Credentials:
GitHub response status: 401
GitHub API error: Bad credentials
→ Fix: Your token is invalid or expired
Step 2: Verify Remote URL
Check Your Remote URL
- Open Repository dialog
- Look at "Git URL" field
- Verify format matches one of these:
GitHub (HTTPS):
https://github.com/username/repository.git
https://github.com/username/repository
GitHub (SSH):
[email protected]:username/repository.git
GitLab (HTTPS):
https://gitlab.com/username/repository.git
https://gitlab.com/username/repository
GitLab (SSH):
[email protected]:username/repository.git
Common URL Issues:
❌ Missing protocol:
github.com/user/repo
→ Should be: https://github.com/user/repo.git
❌ Wrong format:
https://github.com:user/repo.git
→ Should be: https://github.com/user/repo.git (slash not colon)
❌ Extra path components:
https://github.com/user/repo/tree/main
→ Should be: https://github.com/user/repo.git
Step 3: Check Credentials
Verify Credentials Exist
- Go to Settings → Git
- Check "Git Credentials" section
- Find entry matching your repository host
GitHub Credentials
Required Format:
- URL Pattern:
github.comorhttps://github.com - Token Type: Personal Access Token (classic)
How to Create GitHub Token:
- Go to GitHub.com → Settings → Developer settings
- Personal access tokens → Tokens (classic)
- Generate new token (classic)
- Select scopes:
- ✅
repo(full repository access)
- ✅
- Copy token
- Add to Shakespeare: Settings → Git → Add Credential
Token Format:
ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GitLab Credentials
Required Format:
- URL Pattern:
gitlab.comorhttps://gitlab.com - Token Type: Personal Access Token
How to Create GitLab Token:
- Go to GitLab.com → Settings → Access Tokens
- Add new token
- Select scopes:
- ✅
api(full API access) - ✅
write_repository
- ✅
- Create token
- Copy token
- Add to Shakespeare: Settings → Git → Add Credential
Token Format:
glpat-xxxxxxxxxxxxxxxxxxxx
Step 4: Test Credential Matching
The credential matcher looks for:
- Exact domain match:
github.commatcheshttps://github.com/user/repo.git - Full URL match:
https://github.commatcheshttps://github.com/user/repo.git
Debug Credential Matching:
Check console for:
Remote URL: https://github.com/user/repo.git
Found credentials: Yes
If "Found credentials: No":
- Add credential with URL pattern:
github.com - Or use full URL:
https://github.com
Step 5: Common Error Messages
"Failed to create pull request | Failed to get GitLab Project: 401"
Cause: GitHub URL detected as GitLab, or bad GitLab credentials
Fix:
- Check console: What platform was detected?
- If detected as GitLab but should be GitHub:
- Verify URL format:
https://github.com/user/repo.git - No typos in domain name
- Verify URL format:
- If correctly detected as GitLab:
- Check GitLab token validity
- Verify token has
apiscope
"No credentials found for GitHub"
Cause: No matching credential in settings
Fix:
- Go to Settings → Git
- Add credential:
- URL:
github.com - Token: Your GitHub personal access token
- URL:
- Try PR creation again
"GitHub API error: Bad credentials"
Cause: Invalid or expired token
Fix:
- Generate new GitHub token
- Update credential in Settings → Git
- Try again
"GitHub API error: 404 Not Found"
Cause: Repository doesn't exist or token doesn't have access
Fix:
- Verify repository exists:
https://github.com/owner/repo - Check token has access to this repository
- Verify owner/repo names are correct
"Validation Failed"
Cause: PR already exists or branch names invalid
Fix:
- Check if PR already exists for this branch
- Verify source and target branches exist
- Ensure branches are different
Step 6: Manual API Test
Test your credentials directly:
GitHub Test:
curl -H "Authorization: token YOUR_TOKEN" \
https://api.github.com/repos/OWNER/REPO
Expected: Repository JSON data
If 401: Token is invalid
If 404: Repository not found or no access
GitLab Test:
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://gitlab.com/api/v4/projects/OWNER%2FREPO
Expected: Project JSON data
If 401: Token is invalid
If 404: Project not found or no access
Best Practices
✅ Do This:
- Use HTTPS URLs - More compatible than SSH in browser
- Include .git suffix - Clearer repo identification
- Test credentials first - Use API test before PR creation
- Check token scopes - Ensure proper permissions
- Keep tokens secure - Don't share or commit them
❌ Avoid This:
- SSH URLs in browser - May not work consistently
- Expired tokens - Regenerate regularly
- Minimal scopes - Ensure
repo/apiaccess - Wrong platform - Don't use GitHub token for GitLab
- Typos in URLs - Double-check owner/repo names
Quick Checklist
Before creating a PR, verify:
- Remote URL is correct format
- Platform detected correctly (check console)
- Credentials exist in Settings → Git
- Token is valid and not expired
- Token has correct scopes (
repofor GitHub,apifor GitLab) - Source and target branches exist
- No existing PR for these branches
- Branch has been pushed to remote
Still Having Issues?
- Clear browser cache - Sometimes helps with stale data
- Try different browser - Rule out browser-specific issues
- Check GitHub/GitLab status - Verify services are operational
- Regenerate token - Create fresh token with correct scopes
- Test in terminal - Verify Git operations work outside Shakespeare
Getting Help
When asking for help, provide:
- Console output - Copy relevant logs
- Remote URL - Sanitize personal info first
- Platform - GitHub or GitLab
- Error message - Exact error text
- Token scopes - What permissions are granted
- Browser - Chrome, Firefox, Safari, etc.
Last Updated: October 14, 2025
Version: 1.0