Common Issues
Issue 1: File Not Appearing in Results
Check 1: Is the file hidden?
ag --hidden "pattern" # include dotfiles
Check 2: Is it git-ignored?
ag -u "pattern" # skip .gitignore
ag -uu "pattern" # skip .gitignore + search hidden
Check 3: Is it in .agignore or .ignore?
cat .agignore
cat .ignore
cat ~/.agignore
Check 4: Is it binary?
ag -a "pattern" # treat all files as text
Issue 2: Pattern Not Matching
Regex special characters:
# BAD: dots and brackets have regex meaning
ag "price[1]" data.py # [1] = character class
# GOOD: literal mode
ag -Q "price[1]" data.py
Case mismatch:
ag -i "pattern" # case insensitive
Issue 3: "ag: binary file matches" message
ag detected binary content in a file. Force text mode:
ag -a "pattern"
Issue 4: Very Slow on Network Mounts
Disable mmap (sequential read is faster on NFS):
ag --nommap --workers 1 "pattern" /mnt/nfs/
Issue 5: Colors in Piped Output
ag auto-disables colors when piping. Force color with:
ag --color "pattern" | less -R
Or disable for clean piped text:
ag --nocolor "pattern" | awk '{print $1}'