No Results — Common Causes
The most disorienting rg experience is running a search for text you can see in a file, only to get empty output. Here is a systematic diagnosis checklist.
Cause 1: File is Git-Ignored
Symptom: The file is inside node_modules/, vendor/, dist/, or your .gitignore lists its pattern.
Diagnosis:
# Show exactly which files rg would search (does not include ignored)
rg --files . | grep "suspicious_file"
Fix: Use -u to override ignore rules:
rg -u "pattern" # ignore .gitignore
rg -uu "pattern" # also include dotfiles
Cause 2: File is Hidden
Symptom: The file starts with . (e.g., .env, .htaccess).
Diagnosis:
ls -a | grep "\.env"
Fix:
rg -uu "DATABASE_URL" # search hidden files and override ignores
rg --hidden "API_KEY" # just hidden files, still respect .gitignore
Cause 3: Wrong File Type
Symptom: You used -t py but the file has no extension or an unusual extension.
Diagnosis:
# Check what rg considers a python file
rg --type-list | grep py
Fix: Remove the type filter or use a glob:
rg "pattern" -g "*.pyw" # match .pyw files manually
Cause 4: Pattern Is Interpreted as Regex
Symptom: You search for price[1] or 192.168.1.1 but get unexpected results or none.
Diagnosis: Special regex characters (., [, ], +, etc.) are interpreted as operators.
Fix: Use fixed-strings mode:
rg -F "price[1]"
rg -F "192.168.1.1"
Cause 5: Smart Case / Case Mismatch
Symptom: The pattern is Error but logs write error.
Fix: Add -i for case-insensitive or -S for smart case:
rg -i "error" app.log
Cause 6: Binary File
Symptom: A file that contains the pattern is not returned because rg detects it as binary (contains null bytes or unusual byte sequences).
Fix:
rg -a "pattern" file.bin # treat as text
rg --text "pattern" . # all files treated as text