openclaw - 💡(How to fix) Fix Gemini web_search provider returns malformed JSON response on plain searches

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Gemini API error: malformed JSON response

Code Example

Gemini API error: malformed JSON response

---

{
  "tools": {
    "web": {
      "search": {
        "provider": "gemini",
        "enabled": true
      }
    }
  },
  "plugins": {
    "entries": {
      "google": {
        "enabled": true,
        "config": {
          "webSearch": {
            "apiKey": "[configured]"
          }
        }
      }
    }
  }
}

---

{
  "query": "OpenClaw Gemini web search test current date May 31 2026",
  "count": 3,
  "country": "US"
}

---

{
  "error": "unsupported_country",
  "message": "country filtering is not supported by the gemini provider. Only Brave and Perplexity support country filtering.",
  "provider": "gemini"
}

---

{
  "query": "OpenClaw Gemini web search test current date May 31 2026",
  "count": 3,
  "language": "en"
}

---

{
  "error": "unsupported_language",
  "message": "language filtering is not supported by the gemini provider. Only Brave and Perplexity support language filtering.",
  "provider": "gemini"
}

---

{
  "query": "OpenClaw Gemini web search test current date May 31 2026",
  "count": 3
}

---

Gemini API error: malformed JSON response

---

{
  "query": "current date today",
  "count": 1
}

---

Gemini API error: malformed JSON response
RAW_BUFFERClick to expand / collapse

Summary

OpenClaw web search is configured to use the Gemini provider. Provider-specific validation errors confirm requests are reaching the Gemini-backed provider, but plain searches fail with:

Gemini API error: malformed JSON response

Environment

  • OpenClaw version: 2026.5.28 (e932160)
  • Installed npm package: [email protected]
  • Platform: Windows / PowerShell
  • Config path: C:\Users\Porygon\.openclaw\openclaw.json
  • Relevant config:
{
  "tools": {
    "web": {
      "search": {
        "provider": "gemini",
        "enabled": true
      }
    }
  },
  "plugins": {
    "entries": {
      "google": {
        "enabled": true,
        "config": {
          "webSearch": {
            "apiKey": "[configured]"
          }
        }
      }
    }
  }
}

Reproduction

Using the OpenClaw web_search tool:

  1. Search with a country filter:
{
  "query": "OpenClaw Gemini web search test current date May 31 2026",
  "count": 3,
  "country": "US"
}

Result:

{
  "error": "unsupported_country",
  "message": "country filtering is not supported by the gemini provider. Only Brave and Perplexity support country filtering.",
  "provider": "gemini"
}
  1. Search with a language filter:
{
  "query": "OpenClaw Gemini web search test current date May 31 2026",
  "count": 3,
  "language": "en"
}

Result:

{
  "error": "unsupported_language",
  "message": "language filtering is not supported by the gemini provider. Only Brave and Perplexity support language filtering.",
  "provider": "gemini"
}
  1. Search without unsupported filters:
{
  "query": "OpenClaw Gemini web search test current date May 31 2026",
  "count": 3
}

Result:

Gemini API error: malformed JSON response
  1. Minimal plain search:
{
  "query": "current date today",
  "count": 1
}

Result:

Gemini API error: malformed JSON response

Expected Behavior

For plain searches without unsupported filters, the Gemini provider should return normalized search results or a structured provider/API error.

Actual Behavior

Plain Gemini-backed web searches fail with Gemini API error: malformed JSON response.

Notes

The unsupported_country and unsupported_language responses indicate the request is reaching the Gemini provider path. The failure appears to occur when parsing or normalizing the successful Gemini search response.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Gemini web_search provider returns malformed JSON response on plain searches