Pre-submission checklist
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.projectId or the default project ID
The google_search tool skips all of this and just uses "unknown".
Steps to reproduce
- Install
[email protected]
- Authenticate with
opencode auth login (one Google account)
- In a session, invoke the
google_search tool 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 — bare parseRefreshParts + || "unknown"
dist/src/plugin/search.js:150 — project: projectId sent in request body
dist/src/plugin/project.js:157 — ensureProjectContext() (correct path, not used by search)
Compliance
Pre-submission checklist
Model used
Not applicable (this affects the
google_searchtool, not model completions)Exact error message
Bug description
The
google_searchtool injected by the plugin always returns a 404 Not Found error because it resolves the project ID using a bareparseRefreshParts()fallback chain that falls through to the literal string"unknown".Root cause in
plugin.js:1115:When an account has no
managedProjectIdorprojectIdstored 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 tov1internal:generateContentwithproject: "unknown"returns 404.Contrast with model request path: The model request path uses
ensureProjectContext()(inproject.js:157) which handles the same situation correctly by:parts.managedProjectIdANTIGRAVITY_DEFAULT_PROJECT_IDparts.projectIdor the default project IDThe
google_searchtool skips all of this and just uses"unknown".Steps to reproduce
[email protected]opencode auth login(one Google account)google_searchtool with any queryResource projects/unknown could not be foundSuggested fix
Replace the bare
parseRefreshParts+|| "unknown"pattern in thegoogle_searchtool withensureProjectContext(), matching how model requests resolve the project ID: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
managedProjectIdpopulated. 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-logsdirectory is created by default. The error is observable from the tool's return value:Search Error: Failed to execute search: 404 Not Foundwith body containingResource 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