Skip to content
This repository was archived by the owner on Mar 30, 2026. It is now read-only.
This repository was archived by the owner on Mar 30, 2026. It is now read-only.

Bug: Invalid platform enum 'MACOS' causes silent provisioning failure on macOS #527

@NicolaiOksen

Description

@NicolaiOksen

Summary

The issue was generated by AI - But it was verified be me.

The plugin sends "MACOS" as the platform value in API calls to Google's Cloud AI Companion endpoints (loadCodeAssist, onboardUser), but the API rejects it as an invalid enum value for google.internal.cloud.code.v1internal.ClientMetadata.Platform.

This causes all new macOS users to silently fail project provisioning — no managedProjectId is ever stored, and they get 403 Permission Denied errors when trying to use any model.

Root Cause

In src/constants.ts (compiled to dist/src/constants.js), the clientMetadata and getAntigravityHeaders() use:

"platform": "MACOS"

The Google API rejects this with:

{
  "error": {
    "code": 400,
    "message": "Invalid value at 'metadata.platform' (type.googleapis.com/google.internal.cloud.code.v1internal.ClientMetadata.Platform), \"MACOS\"",
    "status": "INVALID_ARGUMENT"
  }
}

Tested Values

Value Result
PLATFORM_UNSPECIFIED OK
MACOS INVALID_ARGUMENT
MAC_OS INVALID_ARGUMENT
LINUX INVALID_ARGUMENT
WINDOWS INVALID_ARGUMENT
DARWIN INVALID_ARGUMENT
0 - 5 (numeric) OK

Only PLATFORM_UNSPECIFIED works as a string value. Numeric enum values (0-5) also work.

Impact

  • All new macOS users cannot provision a managed project and will get 403 errors on every request
  • Existing users are unaffected because their managedProjectId was provisioned before Google tightened the enum validation, and the cached value is reused
  • The failure is completely silentloadManagedProject and onboardManagedProject in project.js swallow non-OK responses with continue/break and no warning-level logging

Silent failure chain

OAuth login
  → fetchProjectID calls loadCodeAssist with platform="MACOS"
  → API returns 400 INVALID_ARGUMENT (silently skipped)
  → projectId stored as "" (empty string)
  → ensureProjectContext called on first request
  → loadManagedProject returns null (400 silently skipped)
  → onboardManagedProject also gets 400 (silently breaks)
  → Falls back to ANTIGRAVITY_DEFAULT_PROJECT_ID ("rising-fact-p41fc")
  → Result cached — never retried
  → User sees "Permission denied" on every request

Fix

Replace "MACOS" with "PLATFORM_UNSPECIFIED" in src/constants.ts wherever it appears in platform metadata:

  • getAntigravityHeaders()Client-Metadata header
  • clientMetadata object
  • Any other location where the platform enum is set

Additionally, I'd recommend logging at warn level when loadCodeAssist or onboardUser return non-2xx responses (currently silently swallowed in project.js).

Environment

  • Plugin version: 1.6.0
  • OS: macOS (darwin/x64)
  • Antigravity version: 1.19.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/compatCompatibility with OpenCode, DCPbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions