claude-code - 💡(How to fix) Fix [BUG] Gmail MCP connector: search_threads returns persistent "Internal error encountered" [1 participants]

Official PRs (…)
ON THIS PAGE

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…
GitHub stats
anthropics/claude-code#47024Fetched 2026-04-13 05:43:30
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

Error Message

Every call to search_threads returns:

"Internal error encountered."

No additional error message, stack trace, or error code is provided. The error is identical regardless of parameters passed.

Example calls that all return the same error:

  • search_threads(query="is:unread", pageSize=20)
  • search_threads(query="in:inbox", pageSize=10)
  • search_threads(query="newer_than:2d", pageSize=15)
  • search_threads() [no parameters]

Meanwhile, on the same session:

  • list_drafts(pageSize=50) → returns drafts successfully
  • get_thread(threadId="19d688eae00187a1") → returns full thread successfully
  • list_labels() → returns labels successfully
  • create_draft(...) → creates draft successfully

Fix Action

Fix / Workaround

Impact: Four scheduled tasks depend on search_threads to pull inbox content. All have been degraded since April 9. Workaround implemented using list_draftsget_thread, but this only surfaces threads with existing drafts — it cannot discover new inbound emails.

Workaround currently in use: Using list_draftsget_thread chain to access email content. This only surfaces threads with existing drafts, so new inbound emails that haven't been replied to are invisible. This workaround has been deployed across 4 scheduled tasks to keep them partially functional while search_threads remains broken.

Code Example

Every call to search_threads returns:

"Internal error encountered."

No additional error message, stack trace, or error code is provided. The error is identical regardless of parameters passed.

Example calls that all return the same error:
- search_threads(query="is:unread", pageSize=20)
- search_threads(query="in:inbox", pageSize=10)
- search_threads(query="newer_than:2d", pageSize=15)
- search_threads() [no parameters]

Meanwhile, on the same session:
- list_drafts(pageSize=50) → returns drafts successfully
- get_thread(threadId="19d688eae00187a1") → returns full thread successfully
- list_labels() → returns labels successfully
- create_draft(...) → creates draft successfully
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

The Gmail MCP connector's search_threads tool returns "Internal error encountered" on every invocation in Cowork (Claude Desktop), regardless of query parameters. The issue is persistent — not intermittent — and has been occurring since at least April 9, 2026.

All other Gmail MCP tools (list_drafts, get_thread, list_labels, create_draft) work correctly on the same connector session, confirming the OAuth token and authentication are valid. The issue is isolated to search_threads.

Queries tested (all fail identically):

  • No query (empty)
  • is:unread
  • in:inbox
  • newer_than:2d
  • Various pageSize values (10, 15, 20)

Working Gmail tools (same session, same auth):

ToolStatus
list_drafts✅ Works
get_thread✅ Works
list_labels✅ Works
create_draft✅ Works
search_threads❌ "Internal error encountered"

Timeline:

  • First observed: April 9, 2026
  • Confirmed broken: April 9, 10, 11, and 12, 2026
  • Frequency: 100% failure rate across all sessions (scheduled and interactive)

Impact: Four scheduled tasks depend on search_threads to pull inbox content. All have been degraded since April 9. Workaround implemented using list_draftsget_thread, but this only surfaces threads with existing drafts — it cannot discover new inbound emails.

What Should Happen?

search_threads should return matching Gmail threads (or an empty list if no matches), just like list_drafts and get_thread do on the same authenticated session. All Gmail MCP tools should function when the connector is authenticated.

Error Messages/Logs

Every call to search_threads returns:

"Internal error encountered."

No additional error message, stack trace, or error code is provided. The error is identical regardless of parameters passed.

Example calls that all return the same error:
- search_threads(query="is:unread", pageSize=20)
- search_threads(query="in:inbox", pageSize=10)
- search_threads(query="newer_than:2d", pageSize=15)
- search_threads() [no parameters]

Meanwhile, on the same session:
- list_drafts(pageSize=50) → returns drafts successfully
- get_thread(threadId="19d688eae00187a1") → returns full thread successfully
- list_labels() → returns labels successfully
- create_draft(...) → creates draft successfully

Steps to Reproduce

  1. Open any Cowork (Claude Desktop) session with the Gmail connector active and authenticated.
  2. Call search_threads with any parameters — e.g., search_threads(query="is:unread", pageSize=10).
  3. Observe: returns "Internal error encountered." with no additional details.
  4. Call list_drafts(pageSize=10) on the same session — this succeeds and returns results.
  5. Call get_thread(threadId="<any valid thread ID>") — this also succeeds.

This confirms the Gmail OAuth session is valid and the issue is isolated to the search_threads endpoint.

Note: This reproduces 100% of the time across all Cowork sessions (both interactive and scheduled tasks) since April 9, 2026.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

Cowork (Claude Desktop) — version not available via CLI

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

This bug is filed from Cowork (Claude Desktop), not Claude Code CLI. The Gmail connector is a first-party MCP integration within Claude.ai/Cowork.

Workaround currently in use: Using list_draftsget_thread chain to access email content. This only surfaces threads with existing drafts, so new inbound emails that haven't been replied to are invisible. This workaround has been deployed across 4 scheduled tasks to keep them partially functional while search_threads remains broken.

extent analysis

TL;DR

The most likely fix for the persistent "Internal error encountered" issue with the Gmail MCP connector's search_threads tool is to investigate and resolve the underlying issue specific to this endpoint, potentially involving authentication, API version, or parameter handling.

Guidance

  • Verify that the search_threads endpoint is correctly implemented and handles all possible query parameters and authentication scenarios, as other endpoints like list_drafts and get_thread work correctly with the same authentication.
  • Check the API documentation for any specific requirements or restrictions on the search_threads endpoint that might be causing the error, such as rate limiting or specific parameter formats.
  • Consider testing the search_threads endpoint with a minimal set of parameters or no parameters at all to isolate if the issue is with the endpoint itself or with how parameters are being passed.
  • Since this is a regression and worked in a previous version, comparing changes between versions might highlight the cause of the issue.

Example

No specific code example can be provided without more details on the implementation, but ensuring that the search_threads call is correctly formatted and authenticated, similar to the working list_drafts and get_thread calls, is crucial.

Notes

The lack of detailed error messages or logs makes it challenging to pinpoint the exact cause. The fact that other tools using the same authentication work correctly suggests the issue is isolated to the search_threads endpoint or its handling.

Recommendation

Apply a workaround by continuing to use the list_draftsget_thread chain for accessing email content until the root cause of the search_threads issue can be identified and fixed, acknowledging that this workaround has limitations, such as not discovering new inbound emails without drafts.

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

claude-code - 💡(How to fix) Fix [BUG] Gmail MCP connector: search_threads returns persistent "Internal error encountered" [1 participants]