Troubleshooting
This guide helps you diagnose and resolve common issues with Rawi.
Quick Diagnostics
Section titled “Quick Diagnostics”Check Rawi Status
Section titled “Check Rawi Status”# Check if Rawi is properly installedrawi --version
# View current configurationrawi info
# Test basic functionalityrawi ask "Hello, are you working?"
Common Quick Fixes
Section titled “Common Quick Fixes”Before diving into specific issues, try these common solutions:
- Update Rawi:
npm update -g rawi
- Clear configuration:
rawi configure --reset
- Restart terminal: Close and reopen your terminal
- Check permissions: Ensure proper file permissions for config directory
Installation Issues
Section titled “Installation Issues”Installation Fails
Section titled “Installation Fails”Problem: npm install -g rawi
fails
Symptoms:
- Permission denied errors
- Network timeout errors
- Package not found errors
Solutions:
# Try with elevated permissions (Linux/macOS)sudo npm install -g rawi
# Use npm with different registrynpm install -g rawi --registry https://registry.npmjs.org/
# Clear npm cache and retrynpm cache clean --forcenpm install -g rawi
# Use different package managerpnpm add -g rawi# oryarn global add rawi# orbun add -g rawi
Command Not Found
Section titled “Command Not Found”Problem: rawi: command not found
after installation
Symptoms:
- Bash/shell doesn’t recognize
rawi
command - Works with
npx rawi
but notrawi
Solutions:
# Check if npm global bin is in PATHnpm config get prefixecho $PATH
# Add npm global bin to PATH (add to ~/.bashrc or ~/.zshrc)export PATH="$(npm config get prefix)/bin:$PATH"
# Alternative: Use npxnpx rawi --version
# Check installation locationwhich rawils -la $(npm config get prefix)/bin/rawi
# For Windows, add to PATH in System Environment Variables
Permission Errors
Section titled “Permission Errors”Problem: Permission denied during installation or usage
Solutions:
# Fix npm permissions (preferred method)mkdir ~/.npm-globalnpm config set prefix '~/.npm-global'echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrcsource ~/.bashrc
# Alternative: Change npm permissionssudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
# Windows: Run terminal as administrator
Node.js Version Issues
Section titled “Node.js Version Issues”Problem: Incompatible Node.js version
Symptoms:
engine "node" is incompatible
error- Syntax errors during installation
Solutions:
# Check Node.js versionnode --version
# Update Node.js to latest LTS# Using nvm (recommended)nvm install --ltsnvm use --lts
# Using package manager# Ubuntu/Debiancurl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -sudo apt-get install -y nodejs
# macOS with Homebrewbrew install node
# Windows: Download from nodejs.org
Configuration Issues
Section titled “Configuration Issues”No Provider Configured
Section titled “No Provider Configured”Problem: “No provider configured” error
Symptoms:
- Error when trying to ask questions
- Empty configuration when running
rawi info
Solutions:
# Run interactive configurationrawi configure
# Configure manuallyrawi configure --provider openai --api-key sk-your-key --model gpt-4
# Check current configurationrawi configure --show
# Reset configuration if corruptedrawi configure --reset
API Key Issues
Section titled “API Key Issues”Problem: “Invalid API key” or “Authentication failed”
Symptoms:
- 401 Unauthorized errors
- “Invalid API key” messages
- Authentication failures
Diagnosis:
# Check current API key (partially hidden)rawi configure --show
# Test API key manually# For OpenAIcurl -s https://api.openai.com/v1/models \ -H "Authorization: Bearer $OPENAI_API_KEY"
# For Anthropiccurl -s https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY"
Solutions:
# Update API keyrawi configure --provider openai --api-key sk-your-new-key
# Use environment variablesexport OPENAI_API_KEY="sk-your-key"export ANTHROPIC_API_KEY="sk-ant-your-key"
# Verify key format# OpenAI: starts with sk-# Anthropic: starts with sk-ant-# Google: alphanumeric string
# Check for extra spaces or charactersecho "$OPENAI_API_KEY" | wc -c # Should be expected length
Profile Issues
Section titled “Profile Issues”Problem: Profile not found or corrupted
Symptoms:
- “Profile ‘name’ not found” error
- Inconsistent behavior between profiles
Solutions:
# List all profilesrawi configure --list
# Create missing profilerawi configure --profile work --provider openai --api-key sk-key
# Reset specific profilerawi configure --profile work --reset
# Delete corrupted profilerm ~/.config/rawi/profiles/work.json
# Export and reimport profilerawi configure --profile work --export > work-backup.jsonrawi configure --profile work-new --import work-backup.json
Configuration File Corruption
Section titled “Configuration File Corruption”Problem: Configuration files are corrupted or invalid
Symptoms:
- JSON parsing errors
- Unexpected behavior
- Crashes on startup
Solutions:
# Backup current configcp -r ~/.config/rawi/ ~/.config/rawi-backup/
# Reset all configurationrawi configure --reset
# Manually check configuration filescat ~/.config/rawi/config.json | jq '.' # Validate JSON
# Remove corrupted filesrm ~/.config/rawi/config.jsonrm -rf ~/.config/rawi/profiles/
# Reconfigure from scratchrawi configure
API and Network Issues
Section titled “API and Network Issues”Network Connection Errors
Section titled “Network Connection Errors”Problem: Connection timeouts or network errors
Symptoms:
- “Request timeout” errors
- “Network error” messages
- Connection refused errors
Diagnosis:
# Test internet connectionping google.com
# Test API endpoint connectivity# OpenAIcurl -s https://api.openai.com/v1/models
# Anthropiccurl -s https://api.anthropic.com/
# Check for proxy/firewall issuesecho $HTTP_PROXYecho $HTTPS_PROXY
Solutions:
# Configure proxy if neededexport HTTP_PROXY=http://proxy.company.com:8080export HTTPS_PROXY=http://proxy.company.com:8080
# Increase timeout settingsrawi configure --timeout 60 # 60 seconds
# Try different endpoint (if available)rawi configure --base-url https://api.openai.com/v1
# Use local provider as fallbackrawi configure --provider ollama --model llama2
Rate Limiting
Section titled “Rate Limiting”Problem: “Rate limit exceeded” errors
Symptoms:
- 429 status code errors
- “Rate limit exceeded” messages
- Requests failing after working initially
Solutions:
# Wait and retrysleep 60rawi ask "test question"
# Check usage limits on provider dashboard# OpenAI: platform.openai.com/usage# Anthropic: console.anthropic.com/dashboard
# Use different model with higher limitsrawi configure --model gpt-3.5-turbo # Usually has higher limits
# Upgrade API plan if needed
# Add delays in scriptsfor file in *.txt; do cat "$file" | rawi ask "process this" sleep 5 # Wait 5 seconds between requestsdone
API Quota Exceeded
Section titled “API Quota Exceeded”Problem: Monthly quota or credit limit reached
Symptoms:
- “Quota exceeded” errors
- Billing-related error messages
Solutions:
# Check usage and billing on provider website
# Switch to different provider temporarilyrawi configure --profile backup --provider anthropicrawi ask --profile backup "test question"
# Use local providerrawi configure --provider ollama --model llama2
# Set up billing alerts on provider dashboard
Session and History Issues
Section titled “Session and History Issues”Session Not Found
Section titled “Session Not Found”Problem: “Session not found” error
Symptoms:
- Can’t continue previous conversations
- Session IDs not recognized
Solutions:
# List available sessionsrawi history --sessions
# Check session ID formatrawi history --sessions --verbose
# Start new session if old one is lostrawi ask --new-session "Continue previous discussion about..."
# Clean up corrupted sessionsrawi history --cleanup
History Corruption
Section titled “History Corruption”Problem: History files corrupted or inaccessible
Symptoms:
- Can’t access previous conversations
- Error when running history commands
Solutions:
# Check history directoryls -la ~/.config/rawi/history/
# Backup current historycp -r ~/.config/rawi/history/ ~/.config/rawi/history-backup/
# Clean corrupted historyrawi history --cleanup --force
# Reset history if severely corruptedrm -rf ~/.config/rawi/history/mkdir ~/.config/rawi/history/
Session Context Lost
Section titled “Session Context Lost”Problem: AI doesn’t remember previous conversation context
Symptoms:
- Responses don’t reference earlier messages
- Context seems reset
Solutions:
# Verify you're using the correct sessionrawi history --sessionsrawi ask --session correct-session-id "continue our discussion"
# Check session hasn't expiredrawi history --session session-id --show
# Start new session with contextrawi ask --new-session "Previously we were discussing X, now I want to..."
Performance Issues
Section titled “Performance Issues”Slow Response Times
Section titled “Slow Response Times”Problem: Rawi takes too long to respond
Symptoms:
- Long wait times for responses
- Timeouts occurring
Diagnosis:
# Test with simple questiontime rawi ask "What is 2+2?"
# Check model being usedrawi configure --show
# Test different providersrawi configure --provider anthropictime rawi ask "What is 2+2?"
Solutions:
# Use faster modelrawi configure --model gpt-3.5-turbo # Faster than GPT-4
# Reduce input sizehead -100 large-file.txt | rawi ask "analyze this sample"
# Use local provider for speedrawi configure --provider ollama --model llama2
# Increase timeout if neededrawi configure --timeout 120 # 2 minutes
High Memory Usage
Section titled “High Memory Usage”Problem: Rawi using excessive memory
Symptoms:
- System slowdown
- Out of memory errors
Solutions:
# Monitor memory usagetop -p $(pgrep -f rawi)
# Reduce context windowrawi configure --max-tokens 1000 # Smaller responses
# Clean up old sessionsrawi history --cleanup --older-than 30d
# Restart Rawi processpkill -f rawi # If running in background
Large File Processing
Section titled “Large File Processing”Problem: Issues processing large files
Symptoms:
- Timeouts with large inputs
- “Input too large” errors
Solutions:
# Process in chunkssplit -l 100 large-file.txt chunk_for chunk in chunk_*; do cat "$chunk" | rawi ask "analyze this section"done
# Use head/tail for sampleshead -500 large-file.txt | rawi ask "analyze this sample"
# Compress before sendinggzip -c large-file.txt | base64 | rawi ask "analyze this compressed data"
Shell Integration Issues
Section titled “Shell Integration Issues”Pipe Issues
Section titled “Pipe Issues”Problem: Problems with shell pipes
Symptoms:
- Broken pipe errors
- Data not flowing correctly
Solutions:
# Check pipe syntaxecho "test" | rawi ask "process this"
# Handle broken pipescat large-file.txt | rawi ask "analyze" 2>/dev/null || echo "Pipe failed"
# Use intermediate files if pipes failcat input.txt > temp.txtrawi ask "analyze this file" < temp.txtrm temp.txt
Output Formatting Issues
Section titled “Output Formatting Issues”Problem: Output not displaying correctly
Symptoms:
- Garbled text
- Missing formatting
- ANSI color codes in files
Solutions:
# Force plain text outputrawi ask --format plain "your question"
# Remove ANSI codes when saving to filerawi ask "question" | sed 's/\x1b\[[0-9;]*m//g' > clean-output.txt
# Use different terminal# Try different terminal emulator if display issues persist
Environment Variable Issues
Section titled “Environment Variable Issues”Problem: Environment variables not working
Symptoms:
- API keys not recognized
- Configuration not applied
Solutions:
# Check if variables are setecho $OPENAI_API_KEYecho $RAWI_PROFILE
# Set variables in current sessionexport OPENAI_API_KEY="sk-your-key"
# Make permanent (add to ~/.bashrc or ~/.zshrc)echo 'export OPENAI_API_KEY="sk-your-key"' >> ~/.bashrcsource ~/.bashrc
# Check variable loadingenv | grep -i rawienv | grep -i openai
Platform-Specific Issues
Section titled “Platform-Specific Issues”Windows Issues
Section titled “Windows Issues”Common Windows problems and solutions:
# PowerShell execution policySet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Path issues in Windows$env:PATH += ";$env:APPDATA\npm"
# Use Windows-style pathsrawi ask "analyze this" < C:\path\to\file.txt
# Handle Windows line endingsdos2unix file.txt # Convert if needed
macOS Issues
Section titled “macOS Issues”Common macOS problems:
# Xcode command line toolsxcode-select --install
# Homebrew Node.js conflictsbrew unlink nodebrew link node
# Permission issues with system directoriessudo chown -R $(whoami) /usr/local/lib/node_modules
Linux Issues
Section titled “Linux Issues”Common Linux problems:
# Node.js repository issuescurl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
# Permission issuessudo chown -R $USER:$USER ~/.npm
# Missing dependenciessudo apt-get install build-essential
# SELinux issues (if applicable)sudo setsebool -P httpd_can_network_connect 1
Error Message Reference
Section titled “Error Message Reference”Common Error Messages and Solutions
Section titled “Common Error Messages and Solutions”“Error: Cannot find module ‘rawi’”
# Reinstall Rawinpm uninstall -g rawinpm install -g rawi
“SyntaxError: Unexpected token”
# Update Node.jsnode --version # Should be 18+nvm install --lts
“Error: Request timeout”
# Increase timeoutrawi configure --timeout 180
# Check network connectionping api.openai.com
“Error: Invalid JSON response”
# Check API statuscurl -s https://status.openai.com/
# Try different providerrawi configure --provider anthropic
“Error: File not found”
# Check file pathls -la ~/.config/rawi/cat ~/.config/rawi/config.json
Advanced Troubleshooting
Section titled “Advanced Troubleshooting”Debug Mode
Section titled “Debug Mode”Enable detailed logging for troubleshooting:
# Enable debug outputexport DEBUG=rawi:*rawi ask "test question"
# Verbose moderawi ask --verbose "test question"
# Save debug outputDEBUG=rawi:* rawi ask "test" 2> debug.log
Log Analysis
Section titled “Log Analysis”# Check system logs# macOSlog show --predicate 'process == "rawi"' --last 1h
# Linuxjournalctl -u rawi --since "1 hour ago"
# Check application logstail -f ~/.config/rawi/logs/rawi.log # If logging enabled
Configuration Validation
Section titled “Configuration Validation”# Validate JSON configurationcat ~/.config/rawi/config.json | jq '.'
# Check file permissionsls -la ~/.config/rawi/chmod 700 ~/.config/rawi/chmod 600 ~/.config/rawi/config.json
Network Debugging
Section titled “Network Debugging”# Trace network requestsexport NODE_DEBUG=net,tlsrawi ask "test"
# Use proxy for debuggingexport HTTPS_PROXY=http://localhost:8080 # With proxy tool like mitmproxy
# Check DNS resolutionnslookup api.openai.comdig api.openai.com
Getting Help
Section titled “Getting Help”Collecting Diagnostic Information
Section titled “Collecting Diagnostic Information”When reporting issues, include:
# System informationrawi infonode --versionnpm --versionuname -a # Linux/macOSver # Windows
# Configuration (sanitized)rawi configure --show # Remove sensitive data before sharing
# Recent error logstail -20 ~/.config/rawi/logs/error.log
Reporting Bugs
Section titled “Reporting Bugs”- Check existing issues: Search GitHub issues first
- Provide minimal reproduction: Simple steps to reproduce
- Include environment details: OS, Node.js version, Rawi version
- Sanitize sensitive data: Remove API keys from logs
Community Support
Section titled “Community Support”- GitHub Issues: github.com/withrawi/rawi/issues
- Discussions: github.com/withrawi/rawi/discussions
- Documentation: This documentation site
Preventive Measures
Section titled “Preventive Measures”Regular Maintenance
Section titled “Regular Maintenance”# Update Rawi regularlynpm update -g rawi
# Clean up old sessionsrawi history --cleanup --older-than 30d
# Backup configurationcp -r ~/.config/rawi/ ~/.config/rawi-backup-$(date +%Y%m%d)
# Verify configurationrawi inforawi ask "test connection"
Best Practices
Section titled “Best Practices”- Keep backups: Regular configuration backups
- Monitor usage: Check API usage regularly
- Use version control: Track configuration changes
- Test after updates: Verify functionality after updates
- Use multiple providers: Have backup providers configured
See Also
Section titled “See Also”- FAQ — Frequently asked questions
- Installation Guide — Installation instructions
- Configuration Guide — Configuration reference
- GitHub Issues — Report bugs and get help