The Agent Says "File Not Found" — But the File Is Right There
You're deep in a coding session with Antigravity's agent, and you ask it to refactor a component. The response: "I can't find that file." You check — the file is sitting right there in your project tree. What happened?
This is one of the more frustrating Antigravity experiences because it looks like a simple bug, but the causes range from incomplete indexing to misconfigured ignore files to OS-level permission issues. Retrying the same request won't fix it. You need to identify which layer is broken first.
Here's a systematic walkthrough of every reason this happens and how to fix each one.
The Index Hasn't Finished Building
When you first open a project in Antigravity, a background indexing process scans your files to build the agent's understanding of your codebase. If you start asking questions before this completes, the agent literally doesn't know certain files exist.
Check the status bar at the bottom of Antigravity — if it shows "Indexing..." or a progress indicator, the scan is still running.
# Check how many files need indexing
# Thousands of files means the initial index could take 2-5 minutes
find . -type f -not -path './.git/*' -not -path './node_modules/*' | wc -lFor projects with thousands of files, the initial index takes noticeably longer. If node_modules isn't excluded, tens of thousands of files get scanned, and the agent is essentially useless until it finishes.
The fix: Wait for the status bar to show indexing is complete before making complex requests. For long-term improvement, add a .antigravityignore file to exclude directories the agent doesn't need.
Your .antigravityignore Is Hiding Files You Need
The .antigravityignore file uses the same syntax as .gitignore to exclude files from the agent's index. When configured too broadly, it can silently hide files you actually need the agent to see.
Here's a mistake I've seen trip people up repeatedly:
# ❌ Too broad — excludes ALL JSON and YAML, including config files
*.json
*.yaml
dist/
build/
# ✅ Targeted — only excludes what you actually want hidden
node_modules/
dist/
build/
.next/
*.log
coverage/That first example excludes package.json, tsconfig.json, and every JSON config file in your project. The agent can't see your dependencies or TypeScript configuration, so its suggestions become wildly inaccurate.
How to check:
# View your current ignore rules
cat .antigravityignore
# Test whether a specific file would be excluded
# Since .antigravityignore uses gitignore syntax, this gives a close approximation
git check-ignore -v src/config/settings.jsonOne subtle gotcha: .gitignore rules can also affect Antigravity's indexing. If a file is git-ignored, the agent may not index it either. This matters for files like .env.local or local test fixtures that you intentionally keep out of version control but still want the agent to reference.
Workspace Detection Fails Entirely
Sometimes the issue isn't individual files — Antigravity fails to recognize the project as a workspace at all. The "Agent Customizations" UI shows "no workspaces found," and the agent behaves as if it's working with an empty directory.
Three common causes:
1. No .git/ directory at the project root
Antigravity often uses .git/ as a signal for project boundaries. Opening a directory that hasn't been initialized as a Git repository can cause workspace detection to fail.
# Check if git is initialized
ls -la .git/
# Initialize if missing
git init2. Opening via symlinks
On macOS, opening projects through symlinks (common with Dropbox or iCloud Drive paths) can confuse workspace detection because the resolved path differs from the symlink path.
# Check the real path
realpath .
# Open Antigravity with the resolved path instead
# Use /Users/name/Library/CloudStorage/Dropbox/projects/my-app
# instead of ~/Dropbox/projects/my-app3. Nested project structures
In a monorepo, opening a sub-package directly instead of the repository root can cause the agent to miss the top-level configuration. Open the monorepo root and navigate to the sub-package from there.
Specific Files Invisible to the Agent
The project is recognized, most files work fine, but a handful of specific files are invisible. This is usually one of three things.
File size limits: Antigravity skips files above a certain size threshold during indexing. Large JSON data files, bundled JavaScript, or files with embedded Base64 assets get silently excluded.
# Find large files in your project
find . -type f -not -path './.git/*' -not -path './node_modules/*' \
-size +1M -exec ls -lh {} \;Binary files: Images, fonts, compiled binaries, and other non-text files aren't indexed. If you need the agent to know about them, mention the file path explicitly in your chat message.
Encoding issues: Files saved in non-UTF-8 encodings (Shift-JIS, ISO-8859-1) may not be readable. This is especially common with legacy files brought over from Windows environments.
# Check a file's encoding
file -bi src/legacy/old-module.js
# Output: text/plain; charset=iso-8859-1
# Convert to UTF-8
iconv -f SHIFT-JIS -t UTF-8 src/legacy/old-module.js > src/legacy/old-module-utf8.jsContext Window Overflow
This one is sneakier. The agent knows the file exists and can find it, but it gives incorrect or incomplete answers about its contents. The cause: too much information has been loaded into the context window, pushing out earlier content.
Typical symptoms include the agent "forgetting" a file you referenced five messages ago, or giving confused answers when you ask about ten or more files simultaneously.
Practical fixes:
# Keep @file references focused — 3 to 5 files at a time
# Bad: @src/components/ (dumps the entire directory)
# Good: @src/components/Header.tsx @src/components/Nav.tsxIn long conversations, re-mention important files with @ to bring them back into the active context. Better yet, split your work into focused sessions — one chat per task rather than a single marathon conversation.
For a deeper dive into managing context effectively, see Antigravity Editor Context Control Guide.
Permissions and OS-Specific Issues
File-level read permissions affect the agent too. On macOS, disk access permissions for the Antigravity app can block access to certain directories.
# Check file permissions
ls -la src/config/secrets.json
# Fix read permissions
chmod 644 src/config/secrets.json
# macOS: Grant Antigravity disk access
# System Settings → Privacy & Security → Files and Folders
# Enable access for Documents, Desktop, etc.There's a known issue where launching Antigravity from the macOS GUI causes MCP servers to crash with executable file not found in $PATH. This happens because the GUI app inherits a different $PATH than your terminal.
# Launch Antigravity from the terminal to inherit your shell's PATH
open -a "Antigravity" /path/to/project
# Or explicitly set PATH before launching
export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH"Nuclear Option: Full Cache and Index Reset
If nothing else works, reset Antigravity's cache and index data to force a clean rebuild.
# Delete Antigravity's cache (macOS)
rm -rf ~/Library/Caches/com.google.antigravity/
rm -rf ~/.antigravity/cache/
# Reset project-specific index
rm -rf .antigravity/index/
# Restart Antigravity and wait for re-indexing to completeAfter the reset, you'll need to wait for the full initial index to rebuild. If the problem persists, check whether Antigravity needs an update — version 1.20 and later brought significant indexing stability improvements.
For general slowness issues, Antigravity Performance Troubleshooting covers the broader picture. If you're stuck during initial setup, Antigravity Installation and Setup Error Guide walks through common first-run problems.
Preventing File Recognition Issues
A few habits at project setup time save a lot of debugging later.
Create a .antigravityignore file early and exclude build artifacts: node_modules/, dist/, build/, .next/, coverage/. This alone dramatically speeds up indexing and improves agent accuracy.
Write an AGENTS.md file at the project root describing the directory structure and key files. The agent reads this file first, so it starts with a map of your project rather than discovering it file by file.
Be aware that background indexing consumes credits. Every file save triggers an index update. After bulk operations like npm install or switching Git branches, give the index a moment to catch up before asking the agent complex questions.