Debugging Like a Pro in Google Antigravity: AI-Powered Troubleshooting Guide
Debugging Like a Pro in Google Antigravity: AI-Powered Troubleshooting Guide
Debugging in Google Antigravity combines traditional IDE tools with Gemini 3's AI capabilities. This guide shows you how to find and fix bugs faster than ever.
Debugging Fundamentals
Built-in Debugger
Antigravity includes the VS Code debugger with enhancements:
- Breakpoints with conditions
- Variable inspection
- Call stack analysis
- Watch expressions
- AI-assisted error explanation
Launch Configuration
// .antigravity/launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Server",
"program": "${workspaceFolder}/src/index.ts",
"preLaunchTask": "tsc: build",
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"env": {
"NODE_ENV": "development",
"DEBUG": "*"
}
},
{
"type": "chrome",
"request": "launch",
"name": "Debug Frontend",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/src"
}
]
}
AI-Assisted Debugging
Error Explanation
When you encounter an error, ask Gemini 3:
You: "Explain this error and how to fix it"
TypeError: Cannot read properties of undefined (reading 'map')
at UserList (UserList.tsx:15)
at renderWithHooks (react-dom.development.js:14985)
Gemini 3 response:
## Error Analysis
**Problem:** You're calling `.map()` on `users` but it's `undefined`.
**Root Cause:** The data hasn't loaded yet, or the API returned unexpected data.
**Location:** UserList.tsx line 15
**Fixes:**
1. **Optional chaining:**
```tsx
{users?.map(user => <UserCard key={user.id} user={user} />)}
-
Default value:
const users = data?.users ?? [];