Troubleshooting
Common issues and their solutions. Click any issue below to see the detailed solution.
Installation Issues
"Command not found: gemini"
Windows NPX Installation Issues
"MCP server not responding"
Connection Issues
"Failed to connect to Gemini"
"Timeout errors"
"MCP error -32000: Connection closed"
"Gemini gets cut off" / Early Termination
Problem: Responses appear truncated or Claude reports "Gemini was thinking but got cut off"
Causes:
- Large codebase analysis taking longer than expected
- Complex operations requiring extended processing time
- Client connection management issues
Solutions:
# The tool automatically prevents timeouts with progress updates
# You'll see messages like:
# "🔍 Starting analysis (may take 5-15 minutes for large codebases)"
# "🧠 Gemini is analyzing your request..."
# Use faster Flash model for large requests
/gemini-cli:analyze -m gemini-3-flash-preview @large-file.js
# Break up large analysis into smaller chunks
/gemini-cli:analyze @specific-function.js explain this functionFile Analysis Issues
"File not found"
- Use absolute paths when possible
- Check file permissions
- Verify working directory
"Token limit exceeded" / "Response exceeds maximum allowed tokens (25000)"
Problem: Error shows response of 45,735 tokens even for small prompts
Root cause: Model-specific bug observed in gemini-2.5-pro (former default model). May not affect newer models.
Working models:
- ✅
gemini-3-flash-preview- Works perfectly - ✅
gemini-3.1-pro-preview- Current default, not affected - ❌
gemini-2.5-pro- Always returns 45k+ tokens (known bug)
Solutions:
# Use Flash model (recommended)
/gemini-cli:analyze -m gemini-3-flash-preview "your prompt"
# For large contexts, break into smaller chunks
/gemini-cli:analyze -m gemini-3-flash-preview @file1.js @file2.js
# The default model (gemini-3.1-pro-preview) should not have this issue
/gemini-cli:analyze "brief analysis only"Configuration Issues
Changes not taking effect
- Save config file
- Completely quit Claude Desktop
- Restart Claude Desktop
- Verify with
/gemini-cli:help
Environment variables not working
# Check current settings
echo $GEMINI_MODEL
echo $GOOGLE_GENERATIVE_AI_API_KEYConfigurable Timeout for Large Codebases
Problem: Default MCP client timeout too short for large analysis
Root Cause: Claude Desktop/Claude Code has a hard-coded timeout that cannot be overridden by environment variables.
Solution: The tool now automatically sends progress updates to prevent timeouts
# The tool will automatically send progress messages like:
# "🔍 Starting analysis (may take 5-15 minutes for large codebases)"
# "🧠 Gemini is analyzing your request..."
# "📊 Processing files and generating insights..."
# "⏳ Still processing... Gemini is working on your request"What happens during long operations:
- Progress updates every 25 seconds during active processing
- Backup heartbeat every 20 seconds to ensure connection stays alive
- Clear status messages showing the tool is working
- Automatic completion notification when done
For very large codebases (10,000+ files):
- Consider breaking analysis into smaller chunks
- Use more specific file patterns with
@syntax - Switch to
gemini-3-flash-previewfor faster processing
## Debug Mode
Enable debug logging:
```json
{
"mcpServers": {
"gemini-cli": {
"command": "gemini-mcp",
"env": {
"DEBUG": "true"
}
}
}
}Getting Help
- Check GitHub Issues
- Enable debug mode
- Collect error logs
- Open a new issue with details
Model-Specific Issues
Gemini-2.5-Pro Issues (Legacy)
Known problems (when using gemini-2.5-pro):
- Always returns 45,735 token responses (bug)
- May cause "response exceeds limit" errors
- Not recommended for file analysis
Workaround: Use the default model (gemini-3.1-pro-preview) or Flash
/gemini-cli:analyze -m gemini-3-flash-preview "your prompt"Model Recommendations
| Use Case | Recommended Model | Reason |
|---|---|---|
| General use | gemini-3.1-pro-preview | Default, latest Pro model |
| File analysis | gemini-3-flash-preview | Faster, stable responses |
| Code review | gemini-3.1-pro-preview | Best quality reasoning |
| Large codebase | gemini-3-flash-preview | Better timeout handling |
| Quick questions | gemini-3-flash-preview | Fast responses |
Quick Fixes
Reset Everything
# Remove and reinstall
npm uninstall -g ask-gemini-mcp
npm install -g ask-gemini-mcp
# Reset Gemini CLI
gemini config reset
gemini config set api_key YOUR_API_KEYTest Basic Functionality
# Test Gemini CLI
gemini "Hello"
# Test MCP Tool with Flash model
/gemini-cli:ping
# Test file analysis with working model
/gemini-cli:analyze -m gemini-3-flash-preview @README.md summarizePlatform-Specific Issues
Windows 11
- NPX flag issues: Use
--yesinstead of-y - Path problems: Restart terminal after Node.js installation
- Connection issues: Ensure Windows Defender isn't blocking Node.js
macOS
- Permission issues: Use
sudoif npm install fails - Terminal restart: Required after installing dependencies
Linux
- Node.js version: Install via NodeSource for latest version
- npm permissions: Configure npm to avoid sudo usage