Troubleshooting¶
This chapter helps you diagnose and solve common problems when using ripgrep. Most issues can be resolved by understanding ripgrep's filtering behavior and using the --debug flag to see what's happening behind the scenes.
Most Common Issues¶
Symptom: Search returns no matches when you expect results.
Quick Fix:
# Check which files would be searched
rg --files | head -20 # (1)!
# See detailed filtering info
rg --debug pattern 2>&1 | head -30 # (2)!
# Try unrestricted search
rg -uuu pattern # (3)!
- Shows first 20 files that would be searched. If your target files aren't listed, they're being filtered out.
- Displays debug output showing which files are searched and which are ignored.
- Disables all filtering including gitignore, hidden files, and binary detection.
→ See No Results Found for detailed guidance.
Symptom: Search takes longer than expected.
Quick Fix:
# Check search statistics
rg --stats pattern # (1)!
# Limit to specific file types
rg -tpy pattern # (2)!
# Use glob patterns
rg -g '*.py' pattern # (3)!
- Shows number of files searched, bytes searched, and time taken.
- Searches only Python files using built-in type filter.
- Searches only files matching the glob pattern.
→ See Performance Issues for optimization strategies.
Symptom: Ripgrep exits with an error.
Quick Fix:
# Common regex syntax errors
rg 'pattern(' # Missing closing parenthesis
# Error: regex parse error
# Try literal search if pattern is complex
rg -F 'pattern(' # (1)!
# Check encoding issues
rg --encoding=auto pattern # (2)!
- The
-Fflag treats your pattern as literal text, not regex. - Automatically detects file encoding instead of assuming UTF-8.
→ See Common Error Messages for detailed solutions.
Symptom: Files skipped as binary or garbled output.
Quick Fix:
# Search binary files
rg -a pattern # (1)!
# Specify encoding
rg --encoding=latin1 pattern # (2)!
# Show binary file detection
rg --debug pattern 2>&1 | grep -i binary # (3)!
- Treats binary files as text and searches them.
- Uses Latin-1 encoding instead of default UTF-8.
- Shows which files are detected as binary and why.
→ See Binary and Encoding Problems for more details.
Quick Troubleshooting Checklist¶
Diagnostic Steps
If you're experiencing unexpected behavior, try these steps in order:
- Run with
--filesto see which files would be searched (without actually searching) - Run with
--debugto see what files are being searched and why others are skipped - Try
-uuu(unrestricted search) to temporarily disable all filtering - Use
-Fto search for literal text instead of a regex pattern - Try
-ito make the search case-insensitive - Check
--statsto see how many files were searched and matches found - Review the Basics for fundamental concepts
Be Careful with Unrestricted Search
The -uuu flag disables all filtering including gitignore rules, hidden files, and binary detection. This can make ripgrep search thousands of unwanted files (like node_modules/, .git/, build artifacts) and significantly slow down your search. Use it only for diagnostic purposes to confirm filtering is the issue, then use more targeted flags like -uu or specific --no-ignore options.
Troubleshooting Decision Flow¶
flowchart LR
Start[Unexpected Behavior] --> Type{What's the issue?}
Type -->|No results| NoResults[No Results Found]
Type -->|Too slow| Perf[Performance Issues]
Type -->|Error message| Error[Error Messages]
Type -->|Binary/encoding| Binary[Binary/Encoding]
NoResults --> Debug1{Run --files}
Debug1 -->|Files shown| Debug2["Run --debug
Check filtering"]
Debug1 -->|No files| Filter["Check ignore rules
.gitignore, .ignore"]
Debug2 --> Pattern{Pattern issue?}
Pattern -->|Maybe regex| TryLiteral[Try -F for literal]
Pattern -->|Case sensitive| TryCase[Try -i for case-insensitive]
Pattern -->|Complex regex| RegexHelp[See Regex Guide]
Perf --> Stats[Run --stats]
Stats --> Many{Too many files?}
Many -->|Yes| TypeFilter["Use -t for file types
or -g for globs"]
Many -->|No| PerfGuide[See Performance Guide]
Error --> ErrorGuide[Check Error Messages page]
Binary --> BinaryGuide[Check Binary/Encoding page]
Filter --> DebugPage[Debug Flags page]
Debug2 --> DebugPage
TryLiteral --> NoResultsPage[No Results page]
TryCase --> NoResultsPage
RegexHelp --> NoResultsPage
TypeFilter --> PerfPage[Performance page]
PerfGuide --> PerfPage
ErrorGuide --> ErrorPage[Errors page]
BinaryGuide --> BinaryPage[Binary/Encoding page]
style Start fill:#ffebee
style NoResults fill:#fff3e0
style Perf fill:#fff3e0
style Error fill:#fff3e0
style Binary fill:#fff3e0
style DebugPage fill:#e8f5e9
style NoResultsPage fill:#e8f5e9
style PerfPage fill:#e8f5e9
style ErrorPage fill:#e8f5e9
style BinaryPage fill:#e8f5e9
Figure: Troubleshooting decision flow showing how to diagnose common issues and navigate to the relevant guide section.
How to Use This Guide
Quick fix needed? Check the Most Common Issues section above for tabbed examples with annotated commands.
New to troubleshooting? Follow the decision flow diagram above to identify your issue and get diagnostic steps.
Know your issue category? Jump directly to the relevant detailed guide using the navigation links below.
Navigation¶
This troubleshooting guide is organized into several focused sections:
- Debug Flags - Understanding
--debug,--trace, and--statsflags - No Results Found - Diagnosing why you're getting no search results
- Performance Issues - Optimizing ripgrep search speed
- Common Error Messages - Understanding and fixing error messages
- Binary and Encoding Problems - Handling binary files and encoding issues
- When to File a Bug - Preparing good bug reports and getting help
Related Resources¶
- Basics: Learn fundamental concepts - Basics Guide
- Common Options: See frequently used options - Common Options Reference
- Configuration: See the configuration file chapter for persistent settings
- File Encoding: See the file encoding chapter for encoding details
Still Stuck?
If you've tried the troubleshooting steps and still can't resolve your issue, check the bug reports page for guidance on how to file a detailed bug report and get help from the community.