ANTIGRAVITY LABJP
Articles/Tips & Best Practices
Tips & Best Practices/2026-03-26Beginner

How to Fix Antigravity Agent Infinite Loading and Freezing

Troubleshooting guide for Antigravity agents stuck on 'Generating...', 'Working...', or 'Loading...' states. Covers tool execution timeouts, browser subagent failures, file processing limits, network connectivity issues, and workspace corruption—with step-by-step recovery procedures.

antigravity385troubleshooting103infinite-loadingagent15freeze

If you've been using Antigravity for any length of time, you've probably hit a moment where the agent gets stuck showing "Generating..." or "Working..." and refuses to move forward. These infinite loading states are frustrating but almost always solvable. This guide walks you through the five main causes and how to fix each one.


The Five Root Causes of Agent Freezing

Antigravity agents hang for predictable reasons. Once you identify which pattern you're dealing with, the fix becomes straightforward.


Cause 1: Tool Execution Timeout — Commands Waiting for Input

What it looks like: You kick off npm install or yarn build, and the agent stays stuck on "Working..." indefinitely.

When a tool (like a shell command) runs, it sometimes gets stuck waiting for input that never comes, or the execution simply takes longer than expected. The agent doesn't know the task failed—it just keeps waiting.

Diagnosis Steps

  1. Check Antigravity's tool logs:

    • Open your workspace dashboard → Activity / Logs tab
    • Look for the most recent tool execution marked as "Pending"
    • This tells you which tool is holding up the agent
  2. Monitor running processes:

    # Mac / Linux
    ps aux | grep -E "npm|yarn|node|ruby|python" | grep -v grep
     
    # Windows (PowerShell)
    Get-Process | Where-Object {$_.ProcessName -like "*npm*" -or $_.ProcessName -like "*node*"}
  3. Check system resources:

    # Real-time CPU and memory monitoring
    top -o %CPU  # Mac / Linux
    # or
    htop  # If available on Linux

Fix Steps

  • Force-stop the agent: Click the "Stop Agent" button in the Antigravity app. If it doesn't respond, restart the entire app.

  • Adjust timeout settings: Edit antigravity.config.json (or .gemini/config.json) to increase tolerance:

    {
      "toolTimeout": 30000,
      "commandTimeout": 60000
    }
  • Eliminate interactive prompts: Use --non-interactive flags to ensure commands don't expect user input:

    npm ci --non-interactive
    npm install --legacy-peer-deps --no-optional
  • Break down large tasks: Split big build operations into smaller, verifiable steps. This lets the agent confirm progress along the way.


Cause 2: Browser Subagent Failure — Page Load Errors

What it looks like: The agent tries to interact with a browser preview or fetch a web page, then stops moving.

Antigravity uses a browser subagent to navigate pages, scroll, and click elements. When this subagent encounters errors (JavaScript failures, network timeouts, missing resources), the parent agent hangs waiting for a response that never comes.

Diagnosis Steps

  1. Verify the preview is running:

    • Check if the "Browser Preview" panel is open
    • Look at the address bar—is it actually connected to a running server?
  2. Check for JavaScript errors:

    • Press F12 or right-click → "Inspect" in the preview
    • Go to the Console tab
    • Any red error messages?
  3. Check network requests:

    • In DevTools, click the Network tab
    • Look for requests with status codes like 404, 500, or "Failed"
    • These indicate what's breaking the page load
  4. Review Antigravity logs:

    • Console messages like "Browser agent timeout" or "Page load failed" pinpoint the issue

Fix Steps

  • Reset the browser preview: In the app menu → Browser Preview → Clear Cache

  • Fix JavaScript errors:

    // ❌ DON'T: Assume variables exist
    console.log(window.myVariable)
     
    // ✅ DO: Check before referencing
    if (typeof window.myVariable !== 'undefined') {
      console.log(window.myVariable)
    }
  • Explicitly specify preview URLs: Make it crystal clear to the agent where it should look:

    # Preview runs on http://localhost:3000
    If the agent needs to verify the UI, open this URL in a browser first
    and ensure the server is running.
  • Handle lazy-loaded content: If your page uses infinite scroll or lazy loading, document this in your Brain:

    ## Page Load Behavior
    - Content loads dynamically as you scroll
    - New elements appear 2-3 seconds after scrolling
    - Wait 5+ seconds for everything to load before analyzing
  • Port conflicts: Make sure your preview port isn't blocked:

    # Check what's using port 3000
    lsof -i :3000  # Mac/Linux
    netstat -ano | findstr :3000  # Windows
     
    # Kill the process if needed
    kill -9 <PID>  # Mac/Linux
    taskkill /PID <PID> /F  # Windows

Cause 3: Large File Processing — Memory and Performance Limits

What it looks like: You try to process a large video, audio file, or massive JSON/CSV, and everything locks up.

Processing huge files exhausts Antigravity's memory and CPU. There are practical limits to what a single agent run can handle.

Diagnosis Steps

  1. Check file sizes:

    # Mac / Linux
    ls -lh filename.ext
    du -sh directory/
     
    # Windows (PowerShell)
    Get-Item filename.ext | ForEach-Object {$_.Length / 1MB}
  2. Monitor system resources during processing:

    • Open Activity Monitor (Mac) or Task Manager (Windows)
    • Watch the Memory and CPU columns while the agent runs
    • If either hits 90%+, you've found the bottleneck
  3. Estimate token/context usage:

    • Rough rule: 1 MB of text ≈ 250,000 tokens
    • Antigravity's context window is limited to ~200,000 tokens per run
    • Do the math: Is your file likely to exceed this?

Fix Steps

  • Know the size limits:

    • Single file: Keep under 50 MB
    • Entire project: Under 500 MB total
    • Total context: Stay below 200,000 tokens
  • Split large files:

    # Split JSON by lines (every 1000 lines becomes a new file)
    split -l 1000 large_data.json chunk_
     
    # Split CSV files
    split -l 10000 data.csv chunk_
  • Use sampling for testing:

    # Extract first 1000 lines as a test sample
    head -n 1000 large_file.json > sample.json
  • Document your processing strategy in Brain:

    ## File Handling Guidelines
    - Individual files must not exceed 50 MB
    - Process metadata first; fetch details in follow-up runs
    - Use batch processing for large datasets
    - Avoid loading all data into memory at once

Cause 4: Network Connectivity Issues — API Calls and Firewalls

What it looks like: The agent tries to fetch data from an API, and nothing comes back.

Corporate firewalls, VPNs, proxies, or simple DNS failures can silently block Antigravity's network requests, leaving the agent waiting forever.

Diagnosis Steps

  1. Test basic connectivity:

    # Can you reach the API endpoint?
    curl -I https://api.example.com/endpoint
     
    # Does DNS resolve?
    nslookup api.example.com
    ping api.example.com
     
    # What's the latency?
    time curl -s https://api.example.com/endpoint > /dev/null
  2. Check Antigravity's network log:

    • Open the Console tab in Antigravity
    • Look for HTTP request failures
    • Status codes like "Connection refused" or "Timeout" indicate blocking
  3. Verify proxy settings:

    # Mac / Linux
    env | grep -i proxy
     
    # Windows (PowerShell)
    Get-ChildItem env: | Where-Object {$_.Name -like "*proxy*"}

Fix Steps

  • If you're on a corporate network, ask IT to whitelist:

    • *.antigravity.dev
    • Your API endpoint domains
    • Package registry domains (npm, pip, Maven)
  • Test without VPN: Temporarily disable your VPN to see if that's the culprit.

  • Configure proxy settings if your network requires them:

    # Tell npm to use a proxy
    npm config set proxy http://proxy.company.com:8080
    npm config set https-proxy http://proxy.company.com:8080
     
    # For Python (pip)
    pip install --proxy [user:passwd@]proxy.server:port package_name
  • Build resilience into API calls by documenting retry logic in your Brain:

    ## API Retry Policy
    - Retry failed requests up to 3 times
    - Wait 5 seconds between attempts
    - If all retries fail, return a clear error message
    - Log all attempts for debugging

Cause 5: Workspace Corruption — Corrupted Config or Stale Cache

What it looks like: The same project always hangs in Antigravity, but a different project works fine.

Antigravity maintains local configuration and cache in hidden directories. If these get corrupted or out of sync, the agent will behave erratically.

Diagnosis Steps

  1. Inspect workspace configuration:

    # List Antigravity's hidden directories
    ls -la .antigravity/
    ls -la .gemini/
     
    # Check if state files exist and are readable
    cat .antigravity/state.json 2>/dev/null
  2. Check Git status:

    # Are there uncommitted changes that might be interfering?
    git status
    git log --oneline -n 5

Fix Steps

  • Nuke the hidden directories (this triggers a fresh initialization):

    rm -rf .antigravity/
    rm -rf .gemini/cache
    rm -rf .DS_Store  # Mac: remove system files too
     
    # Restart Antigravity—it will recreate these directories
  • Clear browser cache and cookies:

    • In Antigravity app: Settings → Clear Cache & Cookies
    • Or manually remove:
      rm -rf ~/Library/Caches/Antigravity  # Mac
      rm -rf ~/.cache/Antigravity  # Linux
      del %APPDATA%\Antigravity\Cache  # Windows
  • Refresh npm cache:

    npm cache clean --force
    npm install
  • Test with a fresh workspace: Confirm the issue is project-specific:

    cd /tmp
    mkdir test_project
    cd test_project
    # Open this folder in Antigravity

Complete Recovery Workflow

Here's the step-by-step procedure to get your agent unstuck.

Step 1: Immediate Stop (1 minute)

  1. Click "Stop Agent" in the Antigravity app
  2. Wait 3 seconds
  3. Does it say "Ready"? If not, restart the app entirely

Step 2: Quick Fixes (5 minutes)

# Reset browser preview
# (From app UI) Browser Preview → Clear Cache
 
# Clean npm cache
npm cache clean --force
 
# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install

Step 3: Moderate Fixes (10 minutes)

# Blow away workspace state
rm -rf .antigravity/ .gemini/cache
 
# Clean up system files
rm -rf .DS_Store
 
# Restart Antigravity

Step 4: Targeted Diagnosis (15-30 minutes)

If you're still stuck, go back to the cause that matches your symptoms:

  • Tool Timeout: Run ps aux, check antigravity.config.json
  • Browser Issues: DevTools → Console, look for JavaScript errors
  • File Size: Run ls -lh, split large files
  • Network: Run curl, check proxy settings
  • Corruption: Delete config, let Antigravity reinitialize

Context Management

  • Skip log files and node_modules
  • Load only what's relevant
  • Prioritize the most important files

**Q: I see "Invalid project resource name" error during sign-in. Is that related?**

A: That's a different issue (see the companion guide on sign-in errors). But if it's blocking you, create a fresh workspace to bypass it.

---

## Looking back

Antigravity agent freezes almost always come down to one of five causes:

1. **Tool Timeout** — Commands waiting for input or running too long
2. **Browser Failure** — Page load errors or JavaScript problems
3. **File Size** — Processing too much data at once
4. **Network Issues** — Firewalls, VPNs, or connectivity problems
5. **Workspace Corruption** — Stale cache or broken config

Work through the diagnosis steps for your symptom, apply the fix, and you'll be back up and running. Check the official [Antigravity status dashboard](https://status.antigravity.dev/) if issues persist, or reach out to support with detailed logs.

For long-term stability, document your project's file-handling best practices and network requirements in your Brain. This helps the agent make smarter decisions and prevents many of these issues from happening in the first place.
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
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.
Tips2026-04-16
How to Break Free When Antigravity's Agent Gets Stuck in a Fix Loop
When Antigravity's agent keeps modifying the same code repeatedly, here's how to identify the root cause and escape the loop — with practical techniques that actually work.
📚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 →