-
-
Notifications
You must be signed in to change notification settings - Fork 627
Description
Pre-submission checklist
- I have searched existing issues for duplicates
- I have read the Troubleshooting Guide
- I have read the README installation instructions
Model used
Not applicable (this affects the google_search tool, not model completions)
Exact error message
404 Not Found
Resource projects/unknown could not be found.
Bug description
The google_search tool injected by the plugin always returns a 404 Not Found error because it resolves the project ID using a bare parseRefreshParts() fallback chain that falls through to the literal string "unknown".
Root cause in plugin.js:1115:
const parts = parseRefreshParts(auth.refresh);
const projectId = parts.managedProjectId || parts.projectId || "unknown";When an account has no managedProjectId or projectId stored in the refresh token metadata (which is common for accounts that haven't completed the managed-project provisioning flow), this resolves to "unknown", and the subsequent API call to v1internal:generateContent with project: "unknown" returns 404.
Contrast with model request path: The model request path uses ensureProjectContext() (in project.js:157) which handles the same situation correctly by:
- Checking
parts.managedProjectId - Falling back to
ANTIGRAVITY_DEFAULT_PROJECT_ID - Attempting to load/provision a managed project via the API
- Falling back gracefully to
parts.projectIdor the default project ID
The google_search tool skips all of this and just uses "unknown".
Steps to reproduce
- Install
opencode-antigravity-auth@1.5.1 - Authenticate with
opencode auth login(one Google account) - In a session, invoke the
google_searchtool with any query - Observe 404 error:
Resource projects/unknown could not be found
Suggested fix
Replace the bare parseRefreshParts + || "unknown" pattern in the google_search tool with ensureProjectContext(), matching how model requests resolve the project ID:
// Current (broken):
const parts = parseRefreshParts(auth.refresh);
const projectId = parts.managedProjectId || parts.projectId || "unknown";
// Suggested fix:
const { effectiveProjectId } = await ensureProjectContext(auth);
const projectId = effectiveProjectId;This would make the search tool use the same robust project resolution logic (including auto-provisioning and default fallback) that model requests already use successfully.
Did this ever work?
Not sure — it may have worked for accounts that already had managedProjectId populated. For accounts without it, this has likely always been broken.
Number of Google accounts configured
1
Reproducibility
Always (100%)
Plugin version
1.5.1
OpenCode version
0.0.0-fix/sse-reconnect-refresh-202602171124
Operating System
Ubuntu 24.04.3 LTS (Linux 6.17.0-14-generic x86_64)
Node.js version
v20.20.0
Environment type
Standard (native terminal) — running as a systemd service
Debug logs
No antigravity-logs directory is created by default. The error is observable from the tool's return value: Search Error: Failed to execute search: 404 Not Found with body containing Resource projects/unknown could not be found.
Relevant source locations (v1.5.1):
dist/src/plugin.js:1114-1115— bareparseRefreshParts+|| "unknown"dist/src/plugin/search.js:150—project: projectIdsent in request bodydist/src/plugin/project.js:157—ensureProjectContext()(correct path, not used by search)
Compliance
- I'm using this plugin for personal development only
- This issue is not related to commercial use or TOS violations