Common issues and solutions when setting up and using the GitHub Copilot SDK.
- Installation Issues
- Authentication Issues
- Runtime Issues
- SDK-Specific Issues
- Performance Issues
- Platform-Specific Issues
Symptoms:
$ copilot --version
bash: copilot: command not foundSolutions:
-
Install Copilot CLI extension:
gh extension install github/gh-copilot
-
Verify installation:
gh extension list
-
Add to PATH (if needed):
# Linux/macOS export PATH="$PATH:$HOME/.local/bin" # Add to ~/.bashrc or ~/.zshrc for persistence echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc source ~/.bashrc
-
Windows PATH:
- Add
%USERPROFILE%\.local\binto system PATH - Restart terminal after PATH change
- Add
Symptoms:
$ gh --version
bash: gh: command not foundSolutions:
macOS:
brew install ghLinux (Debian/Ubuntu):
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install ghWindows:
winget install --id GitHub.cliSymptoms:
Error: Requires Node.js 18 or higher
Solutions:
-
Install latest Node.js:
- Visit https://nodejs.org/
- Download LTS version (18+)
-
Using nvm (Node Version Manager):
# Install nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash # Install and use Node 18+ nvm install 20 nvm use 20
-
Verify version:
node -v # Should show v18.x.x or higher
Symptoms:
✗ GitHub CLI is not authenticated
Solutions:
-
Login to GitHub:
gh auth login
-
Follow the prompts:
- Choose "GitHub.com"
- Choose "HTTPS" or "SSH"
- Authenticate via web browser
-
Verify authentication:
gh auth status
-
Refresh Copilot token:
gh auth refresh -s copilot
Symptoms:
Error: Copilot access denied
Error: Authentication token expired
Solutions:
-
Refresh authentication:
gh auth refresh -s copilot
-
Re-login if needed:
gh auth logout gh auth login -
Verify Copilot access:
- Ensure you have an active Copilot subscription
- Check at: https://github.com/settings/copilot
Symptoms:
Error: Address already in use
Error: EADDRINUSE: address already in use :::8080
Solutions:
-
SDK handles this automatically - The SDK should find an available port
-
If issues persist, kill existing processes:
# Find Copilot processes ps aux | grep copilot # Kill specific process kill <PID> # Or kill all copilot processes (be careful!) pkill -f copilot
-
Windows:
# Find process using port netstat -ano | findstr :8080 # Kill process taskkill /PID <PID> /F
Symptoms:
Error: Timeout waiting for CLI server
Error: Failed to connect to Copilot CLI
Solutions:
-
Check CLI is working:
copilot "hello" -
Increase timeout in code:
// TypeScript const client = new CopilotClient({ startupTimeout: 60000, // 60 seconds });
-
Check for antivirus/firewall blocking
-
Restart CLI server:
pkill -f copilot # Then restart your application
Symptoms:
JavaScript heap out of memory
MemoryError
Solutions:
-
Increase Node.js memory (TypeScript):
NODE_OPTIONS="--max-old-space-size=4096" npm start -
Optimize session management:
- Close sessions when done
- Limit conversation history
- Use streaming to reduce memory
-
Python memory optimization:
- Use generators for large datasets
- Implement proper cleanup with
await client.stop()
Symptoms:
Cannot find module '@github/copilot-sdk'
Solutions:
-
Install dependencies:
npm install
-
Clear cache and reinstall:
rm -rf node_modules package-lock.json npm install
-
Check package.json:
{ "dependencies": { "@github/copilot-sdk": "^0.1.0" } }
Symptoms:
TS2304: Cannot find name 'CopilotClient'
Solutions:
-
Install TypeScript types:
npm install --save-dev @types/node
-
Check tsconfig.json:
{ "compilerOptions": { "esModuleInterop": true, "allowSyntheticDefaultImports": true } }
Symptoms:
ModuleNotFoundError: No module named 'copilot'
Solutions:
-
Activate virtual environment:
source venv/bin/activate # Linux/macOS venv\Scripts\activate # Windows
-
Install package:
pip install github-copilot-sdk
-
Verify installation:
pip list | grep copilot
Symptoms:
RuntimeWarning: coroutine was never awaited
Solutions:
-
Use asyncio.run():
import asyncio async def main(): # Your async code pass asyncio.run(main())
-
Ensure all async calls are awaited:
await client.start() await session.send_and_wait({"prompt": "test"})
Symptoms:
cannot find module providing package
Solutions:
-
Install SDK:
go get github.com/github/copilot-sdk/go
-
Update dependencies:
go mod tidy
-
Verify go.mod:
require github.com/github/copilot-sdk/go v0.1.0
Symptoms:
error NU1101: Unable to find package GitHub.Copilot.SDK
Solutions:
-
Add package:
dotnet add package GitHub.Copilot.SDK
-
Restore packages:
dotnet restore
-
Clear NuGet cache:
dotnet nuget locals all --clear
Solutions:
-
Use streaming for faster perceived performance:
const session = await client.createSession({ streaming: true, });
-
Choose appropriate model:
- Faster models:
gpt-4o - More capable:
gpt-4.1
- Faster models:
-
Reduce context:
- Limit conversation history
- Be specific in prompts
Solutions:
-
Close unused sessions:
await session.close(); await client.stop();
-
Limit concurrent sessions:
// Keep track and limit active sessions const MAX_SESSIONS = 5;
-
Use session pooling for frequent requests
If running on Apple Silicon (M1/M2/M3):
# Check if Rosetta is needed
archMost tools now have ARM support, but if needed:
softwareupdate --install-rosettaSymptoms:
Permission denied: '/usr/local/bin/copilot'
Solutions:
-
Install to user directory:
gh extension install github/gh-copilot
-
Fix permissions:
chmod +x ~/.local/bin/copilot
Symptoms:
cannot be loaded because running scripts is disabled
Solutions:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserIf Windows Defender blocks the CLI:
- Add exception for Copilot CLI
- Check Windows Security → App & browser control
- Add
%USERPROFILE%\.local\binto exclusions
- GitHub Status: https://www.githubstatus.com/
- Copilot Status: Check for known issues
-
Run validation script:
bash scripts/validate-env.sh
-
Enable debug logging:
DEBUG=true LOG_LEVEL=debug
-
Report issues:
- GitHub Issues: https://github.com/github/copilot-sdk/issues
- Include:
- Error messages
- SDK version
- Platform and version
- Steps to reproduce
# Check versions
gh --version
copilot --version
node -v
python3 --version
go version
dotnet --version
# Check authentication
gh auth status
# Check Copilot CLI
copilot "test"
# Check processes
ps aux | grep copilot
# Check network
ping github.com-
Keep tools updated:
gh extension upgrade gh-copilot npm update -g
-
Use virtual environments (Python):
- Always activate before installing packages
- One environment per project
-
Use .gitignore:
- Don't commit
.envfiles - Don't commit
node_modules/orvenv/
- Don't commit
-
Regular cleanup:
# Node.js npm cache clean --force # Python pip cache purge
-
Monitor resources:
- Close unused sessions
- Implement proper error handling
- Use timeouts for operations