This guide helps you diagnose and resolve common issues with the GitHub Copilot Coder workflow.
Symptom: Adding the copilot label doesn't trigger the workflow.
Possible Causes & Solutions:
-
Workflow file not in correct location
- ✅ Verify
.github/workflows/copilot-coder.ymlexists - ✅ Check file syntax with
yamllintor GitHub Actions validator
- ✅ Verify
-
Workflow disabled
- ✅ Go to Actions tab → Select workflow → Ensure it's enabled
-
Label name mismatch
-
✅ Verify label is exactly
copilot(case-sensitive)- ✅ Check workflow trigger configuration in YAML
-
Insufficient permissions
- ✅ Verify
GH_TOKENhas required permissions - ✅ Check workflow permissions in YAML file
- ✅ Verify
Symptom: Workflow fails with authentication errors.
Error Messages:
Error: Bad credentials
Error: Resource not accessible by integration
Permission denied
fatal: unable to access '...': The requested URL returned error: 403
Solutions:
-
Verify GH_TOKEN exists and is valid:
# Test token (replace YOUR_TOKEN) curl -H "Authorization: token YOUR_TOKEN" https://api.github.com/user
- Should return your user information
- If "Bad credentials", token is invalid or expired
-
Check fine-grained PAT permissions (if using fine-grained token):
- ✅
contents: read & write- Required for pushing code to branches - ✅
issues: read & write- Required for updating labels and adding comments - ✅
pull_requests: read & write- Required for creating and managing PRs - Missing any of these? Go to GHES → Settings → Developer settings → Personal access tokens → Edit token → Add missing permissions
- ✅
-
Check classic PAT scopes (if using classic token):
- ✅
reposcope - Provides full repository access - ✅
copilot_requestsscope - For Copilot CLI access - Missing scopes? Regenerate token with full
reposcope
- ✅
-
Verify token hasn't expired:
- Go to GHES → Settings → Developer settings → Personal access tokens
- Check expiration date
- If expired, regenerate a new token with no expiration or extended expiration
-
Regenerate and update token:
- Regenerate: GHES → Settings → Developer settings → Personal access tokens → Regenerate
- Update secret: Repository → Settings → Secrets and variables → Actions → Update
GH_TOKEN - Re-run workflow
-
Specific permission errors:
- "Permission denied to push": Add
contents: writepermission - "Cannot edit issue labels": Add
issues: writepermission - "Cannot create pull request": Add
pull_requests: writepermission
- "Permission denied to push": Add
Symptom: Step "📦 Install Copilot CLI" fails.
Error Messages:
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@github/copilot/-/copilot-X.X.X.tgz
Solutions:
-
Verify Copilot version:
- Check if version exists: https://www.npmjs.com/package/@github/copilot
- Update
COPILOT_VERSIONin workflow to latest stable version
-
Network issues:
- Check if runner has internet access
- Verify npm registry is accessible
-
Use cache:
- Cache should prevent repeated downloads
- Clear cache if corrupted: Delete and re-run workflow
Symptom: Step "🧰 Check MCP Access" fails or times out.
Error Messages:
Error: Failed to connect to MCP server
Timeout waiting for MCP server response
Solutions:
-
Check MCP configuration:
cat ~/.config/mcp-config.json- ✅ Verify JSON syntax is correct
- ✅ Ensure all required MCP servers are listed
-
Verify Context7 API key:
- Check if
CONTEXT7_API_KEYsecret is set - Test API key with Context7 service
- Check if
-
Skip MCP verification (temporary):
- Comment out "Check MCP Access" step in workflow
- MCP servers will still be available to Copilot
-
Check network connectivity:
- Ensure runner can access external MCP servers
- Check firewall rules
Symptom: Step "🌿 Create Feature Branch" fails.
Error Messages:
fatal: A branch named 'copilot/123' already exists
Solutions:
-
Branch already exists:
- Delete the existing branch:
git branch -D copilot/123 git push origin --delete copilot/123
- Re-run workflow
- Delete the existing branch:
-
Permission issues:
- Verify
GH_TOKENhas write access to repository - Check branch protection rules
- Verify
Symptom: Step "🤖 Implement Changes with Copilot" fails.
Error Messages:
Error: Copilot request failed
Error: Rate limit exceeded
Solutions:
-
Rate limiting:
- Wait and retry
- Check Copilot usage limits
-
Invalid prompt:
- Review issue description
- Ensure description is clear and detailed
- Check for special characters that might break parsing
-
Model not available:
- Verify
MODELvalue in workflow - Try different model (e.g., change from
claude-haiku-4.5togpt-4)
- Verify
-
Timeout:
- Increase timeout for Copilot step (currently defaults to 6 hours)
- Simplify issue description
Symptom: Step "💾 Commit Changes" fails.
Error Messages:
nothing to commit, working tree clean
Solutions:
-
No changes made:
- Copilot might not have generated any code
- Review Copilot logs to see what happened
- Check if issue description was clear enough
-
Files not added:
- Verify
prepare-commit.shscript logic - Check if files were excluded by
.gitignore
- Verify
-
Git configuration:
- Verify git user.name and user.email are set
- Check in workflow step "Create Feature Branch"
Symptom: Step "🚀 Push Branch" fails.
Error Messages:
fatal: Authentication failed
fatal: could not read Username
Solutions:
-
Token authentication:
- Verify
GH_TOKENis set correctly - Check remote URL configuration in
push-branch.sh
- Verify
-
Protected branch:
- Ensure branch name doesn't match protection rules
- Feature branches should be
copilot/*pattern
-
Repository permissions:
- Verify token has push access
- Check repository settings
Symptom: Step "📬 Create Pull Request" fails.
Error Messages:
Error: Pull request already exists
Error: Base branch does not exist
Solutions:
-
PR already exists:
- Check if PR was created in previous run
- Update existing PR instead of creating new one
-
Base branch missing:
- Verify
mainbranch exists - Change
--baseparameter to correct branch name
- Verify
-
GitHub CLI not found:
- Verify
ghCLI is installed (should be pre-installed on GitHub runners) - Check workflow logs for CLI installation
- Verify
Symptom: Issue labels don't update during workflow.
Solutions:
-
Permissions:
- Verify
issues: writepermission in workflow - Check
GH_TOKENhas issue permissions
- Verify
-
Label doesn't exist:
- Create labels manually:
copilotin-progressready-for-review
- Create labels manually:
-
GitHub CLI issues:
- Test
ghCLI authentication:gh auth status
- Test
Add debug logging to workflow:
env:
ACTIONS_STEP_DEBUG: true
ACTIONS_RUNNER_DEBUG: true- Go to Actions tab
- Select failed workflow run
- Expand each step to see detailed logs
- Look for error messages and stack traces
- Go to failed workflow run
- Scroll to Artifacts section
- Download
copilot-logsartifact - Review logs for Copilot execution details
Note: Scripts are only used for deployment (
deploy-to-repo.ps1/deploy-to-repo.sh). All workflow logic is embedded in the master workflows, so there are no scripts to test for workflow debugging.
Test deployment scripts:
# Test deploy-to-repo.ps1 (PowerShell)
.\scripts\deploy-to-repo.ps1 -GhesHost "ghes.example.com" -Owner "myorg" -Repo "test-repo" -GhToken "ghp_xxx"# Test deploy-to-repo.sh (Bash)
./scripts/deploy-to-repo.sh ghes.example.com myorg test-repo ghp_xxx# Check repository secrets
gh secret list
# Check workflow files
gh workflow list
# Check workflow runs
gh run list --workflow=copilot-coder.ymlSymptom: Workflow takes longer than expected (>10 minutes).
Solutions:
-
Cache not working:
- Verify cache key in workflow
- Check cache hit rate in logs
- Clear cache and rebuild
-
Network latency:
- Use self-hosted runners closer to your location
- Consider mirroring npm/pip packages locally
-
Copilot slow response:
- Try different model
- Simplify issue description
- Break large tasks into smaller issues
Symptom: Workflow uses too much memory/CPU.
Solutions:
- Use self-hosted runners with more resources
- Optimize MCP servers: Remove unused servers from config
- Reduce logging: Set
--log-leveltoerrorinstead ofall
- ✅ Check this troubleshooting guide
- ✅ Review workflow logs
- ✅ Download and review Copilot logs
- ✅ Test scripts locally
- ✅ Search existing issues
Include the following information:
- Workflow run URL
- Error message (exact text)
- Steps to reproduce
- Workflow logs (relevant sections)
- Copilot logs (if available)
- Environment details:
- GHES version
- Runner type (hosted/self-hosted)
- Copilot CLI version
# Check GitHub CLI version
gh --version
# Check Node.js version
node --version
# Check npm version
npm --version
# Check Python version
python --version
# Check git version
git --version
# Test Copilot CLI
copilot --version
# Test GitHub API access
gh api user
# List workflow runs
gh run list --workflow=copilot-coder.yml --limit 10
# View specific workflow run
gh run view <run-id> --log
# List repository secrets (names only)
gh secret list- Start simple: Test with a simple "Hello World" issue first
- Use caching: Properly configured caching reduces execution time by 50%
- Monitor logs: Regularly review logs to catch issues early
- Keep updated: Update Copilot CLI version regularly
- Document issues: Keep track of issues and solutions for your team