Skip to main content

Error Handling & Retry Logic

Antigravity Manager implements intelligent error handling and automatic retry mechanisms to provide a seamless experience even when upstream APIs encounter issues.

Error Classification

Location: src-tauri/src/error.rs and src-tauri/src/proxy/mappers/error_classifier.rs

Error Types

HTTP Status Classification

Error Classifier

Automatic Retry Logic

Location: Throughout proxy handlers

429 Rate Limit Handling

When a 429 Too Many Requests is received:
  1. Immediate account rotation:
  2. Smart cooldown:
  3. Quota refresh:

401 Token Expiry

When a 401 Unauthorized is received:
  1. Silent token refresh:
  2. Automatic re-enablement: When token refresh succeeds, account is automatically re-enabled.

403 Validation Block

When a 403 Forbidden is received:
  1. Account marking:
  2. Immediate rotation:
  3. UI notification: Account details page shows validation link for user action.

404 Model Not Found

Specific to Google Cloud Code API phased rollouts:

500/503 Server Errors

Exponential backoff for temporary server issues:
Backoff schedule:
  • Retry 1: 100ms
  • Retry 2: 200ms
  • Retry 3: 400ms

Account Rotation Strategy

Location: src-tauri/src/proxy/token_manager.rs

Smart Account Selection

Quota Score Calculation

Cooldown Management

Self-Healing Features

Location: Changelog references in README.md

Automatic Quota Refresh

Background task refreshes quota every N minutes:

Project ID Recovery

When project ID is missing or invalid:

Thinking Signature Recovery

When thinking blocks fail due to missing signatures:
This is automatically applied when:
  • Tool history exists (from previous turns)
  • Retry attempt is detected
  • Signature validation fails

Account Index Auto-Repair

If account index becomes corrupted:
Triggered automatically when:
  • Index file is missing
  • Index contains invalid entries
  • Account count mismatch detected

Quota Protection

Prevents requests when quota is exhausted:
Integrated into account selection:

Error Recovery Modes

Permissive Mode

For first-time thinking requests (no history):

Strict Mode

For tool calls with thinking:

Adaptive Mode

Dynamically adjusts based on context:

Monitoring & Logging

All errors are logged with context:
Accessible via:
  • UI logs page (/api/logs)
  • System logs (stored in data directory)
  • Debug console (if enabled)

Best Practices

  1. Add multiple accounts for seamless rotation
  2. Enable auto-refresh to keep quota status current
  3. Monitor logs for recurring errors
  4. Respond to 403s by following validation links
  5. Keep tokens fresh by using accounts regularly

See Also