
How to fix Quota limits and OAuth issue in Antigravity?
You signed in to Antigravity Pro but still hit quota errors or OAuth failures. Logs show auth never reaches the language server, so your session looks unauthenticated and rate-limited.
How to fix Quota limits and OAuth issue in Antigravity?
The issue presents as Pro users getting “quota exceeded” and OAuth prompts even after sign-in. In the logs you’ll see errors like: LanguageServerClient must be initialized first!, failed to set auth token, and You are not logged into Antigravity.
The Problem
When the Antigravity extension loads, it starts background tasks (user status, models, etc.) that depend on the Language Server Client (LS client). Due to an init-order bug, the extension tries to send auth and read user status before the LS client is ready.
Actual log pattern:
2026-01-24 21:46:36.769 [info] [Window] Started local extension host with pid 12873.
2026-01-24 21:46:37.365 [error] [Window] [Extension Host] Failed to update user status Error: LanguageServerClient must be initialized first!
2026-01-24 21:46:37.770 [info] (Antigravity) 2026-01-24 21:46:37.770 [INFO]: Language server started
2026-01-24 21:46:37.774 [info] W0124 21:46:37.764515 12909 client.go:137] failed to set auth token
2026-01-24 21:46:37.774 [info] W0124 21:46:37.765235 12909 log_context.go:106] Cache(userInfo): Singleflight refresh failed: You are not logged into Antigravity.
2026-01-24 21:46:37.774 [info] I0124 21:46:37.773667 12909 server.go:1504] initialized server successfully in 222.073667msExpected pattern once fixed:
[Extension Host] Initializing LanguageServerClient...
(Language server started)
[Extension Host] LanguageServerClient initialized
[Extension Host] Authenticated session detected; setting auth token
client.go:137 auth token set
Cache(userInfo): refresh succeeded
[Extension Host] Starting update loop (user status / available models)If you also have login challenges, see our short login troubleshooting checklist.
Solution Overview
| Aspect | Detail |
|---|---|
| Root Cause | Init-order bug: extension starts auth-dependent work before the LS client is ready, so the auth token never reaches the language server and you appear logged out. |
| Primary Fix | Initialize the LS client first, await client readiness, then set the auth token, then start polling (user status/models). Add retries and session-change hooks. |
| Complexity | Medium |
| Estimated Time | 30–60 minutes (maintainer hotfix), 5–10 minutes (user workaround) |
For a quick overview of how quotas behave when the session isn’t authenticated, see this brief quota behavior note.
How to fix Quota limits and OAuth issue in Antigravity?
Step-by-Step Solution
-
Step 1 — Update Antigravity to the latest version
-
Many teams ship a hotfix that reorders initialization.
-
In VS Code: Extensions (Ctrl/Cmd+Shift+X) → search “Antigravity” → Update → Reload.
-
Step 2 — Quick user workaround (no code)
-
Purpose: Ensure the LS is up before auth-dependent loops start.
-
Do this sequence once:
- Disable the Antigravity extension.
- Reload Window (Ctrl/Cmd+Shift+P → “Developer: Reload Window”).
- Enable the Antigravity extension.
- Wait 3–5 seconds for “Language server started” in the Output/Logs.
- Sign in again (Ctrl/Cmd+Shift+P → “Antigravity: Sign In”).
-
If you still see “quota exceeded” while Pro, sign out and in again:
-
Ctrl/Cmd+Shift+P → “Antigravity: Sign Out”
-
Reload Window
-
“Antigravity: Sign In”
-
Tip: Verify you’re authenticated via VS Code Accounts (lower left) and that Antigravity shows your Google session.
-
Step 3 — Definitive maintainer fix (extension side, TypeScript)
-
Initialize the Language Server Client, await readiness, then set the token, then start polling loops.
-
Example (TypeScript, VS Code extension):
// src/extension.ts
import * as vscode from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions } from 'vscode-languageclient/node';
let client: LanguageClient | undefined;
async function startLanguageServer(ctx: vscode.ExtensionContext) {
const serverOptions: ServerOptions = {
command: ctx.asAbsolutePath('bin/antigravity-ls'), // adjust path
args: []
};
const clientOptions: LanguageClientOptions = {
documentSelector: [{ scheme: 'file', language: 'plaintext' }], // adjust
};
client = new LanguageClient('antigravityLS', 'Antigravity Language Server', serverOptions, clientOptions);
ctx.subscriptions.push(client.start());
await client.onReady(); // IMPORTANT: gate all interactions on readiness
return client;
}
async function getAuthToken(): Promise<string | undefined> {
// Use VS Code Authentication API
// https://code.studio.com/api/references/vscode-api#authentication
const session = await vscode.authentication.getSession('google', ['openid', 'email', 'profile'], { createIfNone: false });
return session?.accessToken;
}
async function propagateTokenIfAny() {
const token = await getAuthToken();
if (client && token) {
await client.sendNotification('antigravity/authToken', { token });
}
}
async function startPollingLoops() {
// Start loops that need auth AFTER token is set
// e.g., user status/model list refresh
// Implement with setInterval or background tasks; include retry logic.
}
export async function activate(ctx: vscode.ExtensionContext) {
// 1) Start LS first and await onReady
await startLanguageServer(ctx);
// 2) Push token once LS is ready
await propagateTokenIfAny();
// 3) Only now start any polling loops
await startPollingLoops();
// 4) React to session changes; re-propagate token
ctx.subscriptions.push(
vscode.authentication.onDidChangeSessions(async (e) => {
if (e.provider.id === 'google') {
await propagateTokenIfAny();
}
})
);
}
export async function deactivate(): Promise<void> {
if (client) await client.stop();
}-
Also, guard every code path that needs the LS with a readiness check to eliminate “LanguageServerClient must be initialized first!” errors.
-
Step 4 — Definitive maintainer fix (language server side, Go)
-
Provide a handler that accepts and stores the token, logs success, and unblocks dependent caches.
-
Example (Go, LSP server):
// lsp/handlers.go
package lsp
import (
"context"
"errors"
"sync"
)
type AuthManager struct {
mu sync.RWMutex
token string
}
func (a *AuthManager) SetToken(tok string) error {
if tok == "" {
return errors.New("empty token")
}
a.mu.Lock()
a.token = tok
a.mu.Unlock()
return nil
}
func (a *AuthManager) Token() string {
a.mu.RLock()
defer a.mu.RUnlock()
return a.token
}
// In your JSON-RPC or LSP notification handler:
// method: "antigravity/authToken"
func (s *Server) onAuthToken(ctx context.Context, params struct{ Token string }) error {
if err := s.auth.SetToken(params.Token); err != nil {
s.log.Errorf("failed to set auth token: %v", err)
return err
}
s.log.Infof("auth token set")
// Now refresh user caches with the token
go s.refreshUserInfo(ctx)
return nil
}- In places that previously logged “You are not logged into Antigravity.”, add a short retry with backoff that waits for the token:
func (s *Server) refreshUserInfo(ctx context.Context) {
tok := s.auth.Token()
if tok == "" {
// short, bounded retry
for i := 0; i < 5; i++ {
time.Sleep(200 * time.Millisecond)
if tok = s.auth.Token(); tok != "" {
break
}
}
}
if tok == "" {
s.log.Warnf("userInfo refresh skipped: no token")
return
}
// fetch using tok...
if err := s.userCache.Refresh(ctx, tok); err != nil {
s.log.Errorf("userInfo refresh failed: %v", err)
return
}
s.log.Infof("Cache(userInfo): refresh succeeded")
}- Step 5 — Start polling only after auth is confirmed
- Move loops like user status/model discovery after token propagation succeeds.
- Example (TypeScript):
async function startPollingLoops() {
// check server acknowledges auth
await new Promise(resolve => setTimeout(resolve, 200)); // or RPC "isAuthenticated"
// then begin polling
setInterval(() => client?.sendRequest('antigravity/userStatus'), 30_000);
setInterval(() => client?.sendRequest('antigravity/availableModels'), 60_000);
}- Step 6 — Validate with logs
- Expect to see:
- [Extension Host] LanguageServerClient initialized
- [Extension Host] Authenticated session detected; setting auth token
- auth token set
- Cache(userInfo): refresh succeeded
- If you still get quota errors as a Pro user, review this quick fix checklist: resolve common quota blockers.
Alternative Fixes & Workarounds
-
Hot reload after sign-in
-
Sign in, then immediately run: Ctrl/Cmd+Shift+P → “Developer: Reload Window.” This often reorders startup so the token is sent to a ready LS.
-
Defer activation events
-
In package.json, narrow activationEvents so the extension activates a moment later (e.g., on specific commands) instead of onStartupFinished. This gives the LS time to settle before auth-dependent work starts. See Language Server extension guide.
-
Token re-send on reconnect
-
If the LS process restarts or the transport drops, resend the token in onDidChangeState handlers.
Troubleshooting Tips
- Check for these exact strings in logs:
- “LanguageServerClient must be initialized first!”
- “failed to set auth token”
- “You are not logged into Antigravity.”
- If you see “quota exceeded” but you’re Pro, you are likely unauthenticated in the LS.
- Confirm account session in VS Code (Accounts menu) and sign in again from the extension’s command.
- Corporate proxies can block OAuth callbacks. Test on a different network or add proxy exceptions for auth endpoints.
- System clock skew breaks OAuth. Sync time via NTP and retry.
- For maintainers: guard every path that touches the LS with await client.onReady() and add retries around token propagation.
If authentication itself keeps failing, check this short login fix guide.
Best Practices
- Always await LS client readiness before any RPCs or polling.
- Make auth propagation idempotent and retryable; resend on session change and reconnect.
- Gate background loops until an “isAuthenticated” probe succeeds.
- Log clear milestones: initialized, token sent, token acknowledged, cache refreshed.
- Add a health command that reports auth state to the user for quick diagnostics.
- Keep the extension updated; read changelogs for auth/LS fixes.
For a brief primer on VS Code’s auth API, see the official Authentication API reference.
Final Thought
The problem isn’t your Pro plan; it’s an init-order bug that drops your auth token before the language server is ready. Fixing the startup order or using the quick reload/sign-in workaround restores authentication and stops the bogus quota errors immediately.
Subscribe to our newsletter
Get the latest updates and articles directly in your inbox.
Related Posts

How to fix Antigravity hangs due to high memory consumption on Windows x64?
How to fix Antigravity hangs due to high memory consumption on Windows x64?

How to fix crashes and bugs in Antigravity with temporary workarounds?
How to fix crashes and bugs in Antigravity with temporary workarounds?

How to fix Error generating commit message in Antigravity?
How to fix Error generating commit message in Antigravity?

