ANTIGRAVITY LABJP
Articles/Tips & Best Practices
Tips & Best Practices/2026-04-12Beginner

Fixing Antigravity When Files Are Missing or the Agent Can't Access Your Project

Practical troubleshooting guide for when Antigravity's agent can't find your project files, workspace detection fails, or indexing breaks. Covers .antigravityignore, permissions, and context overflow.

antigravity436troubleshooting108workspace7file-indexingagent17

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 -l

For 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.json

One 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 init

2. 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-app

3. 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.js

Context 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.tsx

In 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 complete

After 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.

Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

Tips2026-05-24
Why Antigravity's Agent Keeps Referencing the Previous Repo After You Switch Projects — Diagnosis and Fix
When Antigravity carries leftover state from your previous project into a new one, the agent confidently edits files that don't belong to the current repo. Here's how to diagnose and prevent that context bleed.
Tips2026-04-25
When Antigravity's Workspace Indexing Won't Finish: A Field Guide to Fixing Stalled Indexes
Workspace Indexing stuck at 0%, frozen mid-progress, or marked complete but invisible to the agent? Here's a pattern-based diagnostic and repair flow that handles each cause separately.
Tips2026-04-25
Mastering Antigravity's Retry: How to Recover Stuck Agents Without Wasting Credits
Three Retry modes in Antigravity, how to read failure logs in 30 seconds, and a workflow that stops Retry from becoming your only fix.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →