I've integrated a comprehensive logging system to help debug the "Failed to load repositories" error. Here's how to use it:
# Build the app with the new logging
pnpm build
# Run the app (this will generate logs)
node dist/index.js
# Or if you have it linked globally
gh-manager-cliI've created a helper script viewlogs.sh to easily access logs:
# Show last 50 lines of the log
./viewlogs.sh
# Follow the log in real-time (like tail -f)
./viewlogs.sh follow
# Show only errors
./viewlogs.sh errors
# Show the full log
./viewlogs.sh full
# Get the log file path
./viewlogs.sh pathThe logs are stored at:
- macOS:
~/Library/Logs/gh-manager-cli/gh-manager-cli.log - Linux:
~/.local/state/gh-manager-cli/gh-manager-cli.log - Windows:
%APPDATA%\gh-manager-cli\Logs\gh-manager-cli.log
The logging system now captures:
- GitHub API calls: Token validation, repository fetching, GraphQL queries
- Apollo Client: Initialization, query execution, cache hits/misses
- Octokit fallback: When Apollo fails and Octokit is used
- Error details: Full error messages, stack traces, GraphQL errors, network errors
- Startup: Application version, Node.js version
- Authentication: OAuth flow progress, token validation
- Repository operations: Fetch results, pagination, search queries
- Fatal errors: Uncaught exceptions, unhandled rejections
To debug your "Failed to load repositories" error:
-
Run the app and reproduce the error:
node dist/index.js
-
Check the logs immediately:
./viewlogs.sh errors
-
Look for specific error patterns:
- Authentication failures (401 errors)
- Rate limiting (403 errors)
- Network issues (connection errors)
- Token expiration
- GraphQL query errors
-
Enable debug mode for more details:
GH_MANAGER_DEBUG=1 node dist/index.js
- Check if token is expired: Look for "401" or "Bad credentials" in logs
- Solution: Re-authenticate with OAuth or update PAT
- Look for "rate limit" or "403" errors in logs
- Check the
rateLimitfield in successful responses - Solution: Wait for rate limit reset time shown in logs
- Look for "ECONNREFUSED", "ETIMEDOUT", or "network" errors
- Solution: Check internet connection, GitHub status
- Look for Apollo cache errors
- Solution: Clear cache at
~/.config/gh-manager-cli/apollo-cache.json
If you need help, share the relevant log sections:
# Get recent errors for sharing
./viewlogs.sh errors > error-log.txt
# Or get the last 100 lines
tail -100 ~/Library/Logs/gh-manager-cli/gh-manager-cli.log > recent-log.txt- DEBUG: Detailed information for debugging
- INFO: General information about app flow
- WARN: Warning conditions (fallbacks, retries)
- ERROR: Error conditions that can be recovered
- FATAL: Fatal errors causing app termination
[2025-09-02 14:30:45.123] [INFO ] Message here
[2025-09-02 14:30:45.124] [ERROR] Error message
{
"error": "Detailed error",
"stack": "Stack trace"
}