Skip to content

google_search fails: wrong model name + missing proxy support #358

@kui123456789

Description

@kui123456789

Bug Description

The google_search tool returns empty results (## Search Results\n\n) for all queries.

Root Causes

1. Wrong Model Name (404 Error)

In src/constants.ts, SEARCH_MODEL is set to "gemini-3-flash" which returns HTTP 404.

Fix: Should be "gemini-3-flash-preview"

- export const SEARCH_MODEL = "gemini-3-flash";
+ export const SEARCH_MODEL = "gemini-3-flash-preview";

2. Missing Proxy Support

The fetch call in src/plugin/search.ts doesn't respect HTTP_PROXY / HTTPS_PROXY environment variables.

For users behind a proxy (common in enterprise environments, China, etc.), the API calls fail silently.

Fix for Bun runtime: Add native proxy option to fetch:

  const response = await fetch(url, {
      method: "POST",
      headers: { ... },
      body: JSON.stringify(wrappedBody),
      signal: abortSignal ?? AbortSignal.timeout(SEARCH_TIMEOUT_MS),
+     proxy: process.env.HTTPS_PROXY || process.env.HTTP_PROXY || process.env.https_proxy || process.env.http_proxy,
  });

Environment

  • OS: Windows 11 (Git Bash)
  • OpenCode version: latest
  • Bun version: 1.3.8
  • Plugin version: 1.4.3

Verification

Direct API call through proxy works perfectly:

curl -x http://127.0.0.1:10808 -X POST \
  "https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:generateContent" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"project":"...","model":"gemini-3-flash-preview","request":{...}}'
# Returns full search results ✓

Workaround

Manually patch the compiled files in node_modules:

# Fix model name
sed -i 's/SEARCH_MODEL = "gemini-3-flash"/SEARCH_MODEL = "gemini-3-flash-preview"/' \
  ~/.config/opencode/node_modules/opencode-antigravity-auth/dist/src/constants.js

# Add proxy option to fetch call in search.js
# (add proxy: process.env.HTTPS_PROXY || ... to the fetch options)

Then restart OpenCode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/modelsModel access, Claude/Gemini specificbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions