openclaw icon indicating copy to clipboard operation
openclaw copied to clipboard

[Bug]: Gemini 3 models return 404 Not Found - Invalid model ID sent to Google API

Open pein1337-jpg opened this issue 10 months ago • 1 comments

Description

When using Gemini 3 models (e.g., google/gemini-3-flash-preview), clawdbot sends the full model ID including the provider prefix to the Google Generative AI API, but the API expects only the model name without the prefix.

Error: 404 Not Found from Google Generative AI API

Environment

  • clawdbot version: 2026.1.9 (also affects 2026.1.10, 2026.1.11-4)
  • @mariozechner/pi-ai version: 0.43.0
  • Model: google/gemini-3-flash-preview (also affects other Gemini 3 models)
  • Node.js: v22.21.1

Steps to Reproduce

  1. Configure clawdbot with Gemini 3 model:
    {
      "agents": {
        "defaults": {
          "model": {
            "primary": "google/google/gemini-3-flash-preview"
          }
        }
      },
      "models": {
        "providers": {
          "google": {
            "models": [
              {
                "id": "google/gemini-3-flash-preview",
                "name": "Gemini 3 Flash Preview"
              }
            ]
          }
        }
      }
    }
    
  2. Send a message to the bot
  3. Bot returns 404 error from Google API

Expected Behavior

The bot should strip the google/ prefix from the model ID before sending it to the Google API.

Actual Behavior

The bot sends the full model ID google/gemini-3-flash-preview to the API, which expects only gemini-3-flash-preview.

Root Cause

In node_modules/@mariozechner/pi-ai/dist/providers/google.js (around line 262-268), the model ID is passed directly without stripping the provider prefix:

const params = { model: model.id, // ← Sends "google/gemini-3-flash-preview" contents, config, };

Proposed Solution

Strip the provider prefix before sending to the Google API:

// Fix: Extract just the model name without provider prefix for Google API const modelName = model.id.includes('/') ? model.id.split('/').pop() : model.id; const params = { model: modelName, // ← Sends "gemini-3-flash-preview" contents, config, };

Workaround

Manually patch node_modules/@mariozechner/pi-ai/dist/providers/google.js after each npm update:

  const params = {
  •   model: model.id,
    
  •   // Fix: Extract just the model name without provider prefix for Google API
    
  •   const modelName = model.id.includes('/') ? model.id.split('/').pop() : model.id;
    
  •   model: modelName,
      contents,
      config,
    
    };

Additional Context

This fix should be added to the existing patches/@[email protected] file in clawdbot, or submitted upstream to https://github.com/badlogic/pi-mono.

The current patch file doesn't include dist/providers/google.js, so this issue affects all Gemini 3 users.

Verification

After applying the fix, Gemini 3 models work correctly with the Google Generative AI API.

Tested with:

  • clawdbot 2026.1.9, 2026.1.10, 2026.1.11-4
  • @mariozechner/pi-ai 0.42.2, 0.43.0
  • google/gemini-3-flash-preview
  • Node.js v22.21.1

pein1337-jpg avatar Jan 12 '26 18:01 pein1337-jpg

I tried implementing a fix in https://github.com/clawdbot/clawdbot/pull/797 , but ended up closing the PR due to pre-existing Swift linting errors blocking CI.

Issue The CI check for macOS Swift linting is failing with errors in:

apps/macos/Sources/ClawdbotWizardCLI/main.swift (lines 25, 27, 29, 35, 119, 121, 122) apps/macos/Sources/Clawdbot/OnboardingWizard.swift (line 152) These errors exist in upstream/main and are not caused by any changes in this PR.

@pein1337-jpg - the fix you proposed in https://github.com/clawdbot/clawdbot/issues/795 is ready in the patch file. Once Swift lint is fixed upstream, we can merge this I believe.

juanpablodlc avatar Jan 12 '26 20:01 juanpablodlc