Sorry, I hit a snag. Please try again shortly or modify your prompt"

I have the following problem “Sorry, I hit a snag. Please try again shortly or modify your prompt” and it sends this message “[GoogleGenerativeAI Error]: Error fetching from https://monospace-pa.googleapis.com/v1/models/gemini-3-flash-preview:streamGenerateContent?alt=sse: [400 Bad Request] Unable to submit request because Thinking_config.include_thoughts is only enabled when thinking is enabled.. Learn more: Generate content with the Gemini API  |  Gemini Enterprise Agent Platform  |  Google Cloud Documentation” I can’t solve it if someone can help me

This error occurs because your application is sending the parameter include_thoughts: true in the API request, but **thinking/reasoning mode is disabled or set to 0 tokens** in your configuration. The Gemini API requires thinking to be explicitly enabled whenever include_thoughts is requested.

How to Fix It

#1. If you are writing custom code (Python, JavaScript/TypeScript, REST)

Ensure you only set include_thoughts when thinking is actively configured with a token budget or level:

* **JavaScript / TypeScript (@google/genai or @ai-sdk/google):**

```json

// Incorrect (Causes 400 Error if thinking is disabled/0):

“thinkingConfig”: { “includeThoughts”: true }

// Correct (Include thinkingBudget or thinkingLevel):

“thinkingConfig”: {

 "thinkingBudget": 1024,

 "includeThoughts": true

}

```

* **Python (google-genai):**

```python

# Ensure thinking_budget is set if include_thoughts=True

config = {

   "thinking_config": {

       "thinking_budget": 1024,

       "include_thoughts": True,

   }

}

```

* **If you want thinking turned off:** Remove the thinking_config object completely from your API payload.

# 2. If you are using an app or CLI tool (e.g., OpenCode, Gemini CLI, LobeChat, VS Code Extension)

* **Enable Thinking in Settings:** Go into your client settings and turn on “Thinking” / “Reasoning”, or set the reasoning/thinking budget slider above 0.

* **Update the App:** Older versions of several AI clients (like OpenCode or Gemini CLI) had a bug where they unconditionally attached includeThoughts: true even when using non-thinking models or when thinking was turned off. Updating to the latest version fixes this payload issue.

* **Switch Model Configuration:** If your tool allows setting thinkingLevel, set it to **“High”** or **“Medium”** rather than leaving it disabled/off.