#Gemini keeps failing to connect

1 messages · Page 1 of 1 (latest)

cunning acornBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

proper narwhalBOT
#

Let me help you troubleshoot this Gemini connection issue! 🦐

First thing: What version of Clawdbot are you running? Run:

clawdbot --version

Version mismatch is the #1 cause of weird API errors.

In the meantime, check these common issues:

  1. Model name format — Make sure you're using the correct format. The docs use google/gemini-1.5-flash or google/gemini-pro — not just gemini-pro

  2. API key location — Your config should have the key under the Google provider:

#
   "google": {
     "apiKey": "YOUR_GEMINI_API_KEY"
   }
  1. Model config — Under models, make sure it points to the Google provider:

    "models": {
      "gemini": {
        "provider": "google",
        "model": "google/gemini-1.5-flash"
      }
    }
    
  2. Region availability — Some Gemini models aren't available in all regions. Try google/gemini-1.5-flash first as it's more widely available.

#

Once you share your version, I can dig deeper into the docs for any known issues with that release!

vestal fox
#

Clawdbot version --> 2025.1.15,

"auth": {

"profiles": {

"google:default": {

"provider": "google",

"mode": "api_key"

}

}

},

"agents": {

"defaults": {

"model": {

"primary": "google/gemini-3-pro-preview"

},

"models": {

"google-gemini-cli/gemini-2.5-pro": {},

"google/gemini-2.5-pro": {},

"google/gemini-3-pro-preview": {

"alias": "gemini"

}

}
Where is this correct?

proper narwhalBOT
# vestal fox Clawdbot version --> 2025.1.15,  "auth": {     "profiles": {       "google:de...

Aha! I see a couple of issues:

1. Version is old (2025.1.15) — You're a full year behind! Current version is much newer. Update first — this alone might fix it.

2. Model name formatgoogle/gemini-3-pro-preview doesn't look right. The -preview suffix in the model name itself is unusual.

Try these fixes:

Update first:

pnpm update clawdbot
# or if installed globally
npm update -g clawdbot

Then update your config to use a known-working model:

#
{
  "agents": {
    "defaults": {
      "model": {
        "primary": "google/gemini-1.5-flash"
      }
    }
  },
  "models": {
    "gemini": {
      "provider": "google",
      "model": "google/gemini-1.5-flash"
    }
  }
}
#

gemini-1.5-flash is the most reliable and free-tier friendly option.

If you need to stay on your current version, try changing the model to:

  • google/gemini-1.5-pro
  • google/gemini-1.0-pro (older but stable)

The -preview suffix in gemini-3-pro-preview might be causing the provider to reject it as an invalid model name.

Let me know if updating + changing the model name helps! 🦐

vestal fox
#

after running clawdbot version i got this -> 2026.1.15

proper narwhalBOT
# vestal fox after running clawdbot version i got this -> 2026.1.15

Great, so you are on the current version (2026.1.15) — that's not the issue!

The problem is the model name itself: google/gemini-3-pro-preview is not a valid model ID.

Valid model names are:

  • google/gemini-1.5-flash ✨ (recommended, fast & free-tier friendly)
  • google/gemini-1.5-pro
  • google/gemini-1.0-pro

Fix your config:

{
  "agents": {
    "defaults": {
      "model": {
#
        "primary": "google/gemini-1.5-flash"
      }
    }
  },
  "models": {
    "google/gemini-1.5-flash": {
      "alias": "gemini"
    }
  }
}

Or just remove the -preview suffix and try google/gemini-1.5-pro if you want the Pro tier.

The model gemini-3-pro-preview simply doesn't exist in Google's API, which is why you're getting "AI service returned an error" — Clawdbot is trying to call a model that Google doesn't recognize. 🦐

vestal fox
#

okay it has been updated, do i have to use anything to reboot the service?

proper narwhalBOT
# vestal fox okay it has been updated, do i have to use anything to reboot the service?

Yes, you need to restart! The models and agents configs are not hot-reloadable.

Restart the gateway:

clawdbot gateway call config.apply

This will validate your config and restart the gateway with the new settings. You'll see a brief disconnection while it restarts.

Once it's back up, try talking to Gemini again — it should work now with the valid model name! 🦐

vestal fox
#

Gateway call failed: Error: invalid config.apply params: data must have required property 'raw'

proper narwhalBOT
#
tmux kill-session -t clawdbot
clawdbot

Once it's back up with the corrected config, try Gemini again! 🦐

vestal fox
#

it did not seem to work i am still getting the same response

proper narwhalBOT
# vestal fox it did not seem to work i am still getting the same response

Let me dig deeper. Can you share:

1. Your full config (hide API key):

cat ~/.clawdbot/clawdbot.json | grep -v apiKey

2. Check what models are actually available:

clawdbot model list google

The "Message ordering conflict" suggests something deeper than just a bad model name — there might be a config mismatch or the model truly isn't available yet.

Also, just to confirm: did you actually edit the config file or just read about what to change? If you haven't edited it yet, that's why it's still failing!

Share your config and I'll spot the issue! 🦐

vestal fox
#

{
"wizard": {
"lastRunAt": "2026-01-17T06:33:26.509Z",
"lastRunVersion": "2026.1.15",
"lastRunCommand": "onboard",
"lastRunMode": "local"
},
"auth": {
"profiles": {
"google:default": {
"provider": "google",
"mode": "api_key"
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "google/gemini-1.5-flash"
}
}
},
"models": {
"gemini": {
"provider": "google",
"model": "google/gemini-1.5-flash"
}
},
"messages": {
"responsePrefix": "[clawdbot]",
"ackReactionScope": "group-mentions"
},
"commands": {
"native": "auto"
},
"channels": {
"whatsapp": {
"dmPolicy": "allowlist",
"selfChatMode": true,
"allowFrom": [
"PHONE_NUMBER"
],
"groupPolicy": "allowlist",
"mediaMaxMb": 50,
"debounceMs": 0
},
"telegram": {
"enabled": true,
"dmPolicy": "pairing",
"botToken": "MY_TELEGRAM_PRIVATE_API",
"groupPolicy": "allowlist",
"streamMode": "partial"
},
"discord": {
"enabled": true,
"token": "MY_DISCORD_PRIVATE_API",
"groupPolicy": "allowlist"
}
},
"gateway": {
"port": 18789,
"mode": "local",
"bind": "lan",
"auth": {
"mode": "token",
"token": "MY_GATEWAY_TOKEN"
},
"tailscale": {
"mode": "off",
"resetOnExit": false
}
}
}

proper narwhalBOT
# vestal fox { "wizard": { "lastRunAt": "2026-01-17T06:33:26.509Z", "lastRunVersion...

Your config looks correct now! The model is set to google/gemini-1.5-flash which should work.

Quick checks:

  1. Did you actually edit the config file at ~/.clawdbot/clawdbot.json? The config you shared looks right, but just confirming you saved it.

  2. API key location — Your auth.profiles.google:default points to api_key mode, but where's the actual key? It should be in:

    • Environment variable: GOOGLE_API_KEY
    • Or in ~/.clawdbot/credentials.json under google:default
  3. Test your API key directly:

    curl -H "Content-Type: application/json" \
         -H "x-goog-api-key: YOUR_API_KEY" \
         "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent" \
         -d '{"contents":[{"parts":[{"text":"Hello"}]}]}'
    
#

Replace YOUR_API_KEY with your actual key. If this fails, the key is invalid or has no quota.

  1. Try a different modelgoogle/gemini-1.0-pro is more widely available:
    "models": {
      "gemini": { "provider": "google", "model": "google/gemini-1.0-pro" }
    }
    

Which one of these gives you more info about what's broken? 🦐

vestal fox
#

I ran the installation again, and i keep getting the error, my API key is working and responding, here is my clawdbot file

I am running Clawdbot version 2026.1.16-2

{
"auth": {
"profiles": {
"google:manual": {
"provider": "google",
"mode": "token"
},
"google:default": {
"provider": "google",
"mode": "api_key"
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "google/gemini-2.5-pro"
}
}
},
"models": {
"gemini": {
"provider": "google",
"model": "google/gemini-2.5-flash"
}
},
"tools": {},
"commands": {
"native": "auto",
"nativeSkills": "auto"
},
"channels": {
"discord": {
"enabled": true,
"token": "DISCORD_BOT_TOKEN",
"groupPolicy": "allowlist"
},
"telegram": {
"enabled": true,
"botToken": "TELEGRAM_BOT_TOKEN",
"dmPolicy": "allowlist",
"allowFrom": [
"USER_ID_TOKEN"
]
}
},
"gateway": {
"mode": "local",
"auth": {
"mode": "token",
"token": "PRIVATE_GATEWAY_TOKEN"
},
"port": 18789,
"bind": "loopback",
"tailscale": {
"mode": "off",
"resetOnExit": false
}
},
"client": {
"name": "clawdbot-home-server"
},
"messages": {
"ackReactionScope": "group-mentions"
},
"skills": {
"install": {
"nodeManager": "npm"
},
"entries": {
"nano-banana-pro": {
"apiKey": "PRIVATE_API_KEY_FOR_NANO_BANANA_PRO"
}
}
},
"hooks": {
"internal": {
"enabled": true,
"entries": {
"session-memory": {
"enabled": true
}
}
}
},
"wizard": {
"lastRunAt": "2026-01-17T17:30:32.587Z",
"lastRunVersion": "2026.1.16-2",
"lastRunCommand": "onboard",
"lastRunMode": "local"
}
}

proper narwhalBOT
#
      }
    }
  }
}

Also, you have a profile conflict:

  • google:manualmode: "token" (needs OAuth token)
  • google:defaultmode: "api_key" (needs API key)

Pick ONE approach and simplify your auth config. If using API keys, just remove the google:default profile and rely on the env var or models.providers.google.apiKey.

Try this corrected config:

{
#
  "auth": {
    "profiles": {
      "google:default": {
        "provider": "google",
        "mode": "api_key"
      }
    }
  },
  "models": {
    "providers": {
      "google": {
        "apiKey": "PRIVATE_GEMINI_API_KEY"
      }
    },
    "gemini": {
#
      "provider": "google",
      "model": "google/gemini-2.5-flash"
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "google/gemini-2.5-pro"
      }
    }
  }
}

After updating, restart the gateway:

#
clawdbot gateway restart

The "message ordering conflict" error is a symptom of the API failing and retries conflicting with new messages. Fix the API key config and it should resolve! 🦐

vestal fox
#
- models.providers.google.baseUrl: Invalid input: expected string, received undefined
- models.providers.google.models: Invalid input: expected array, received undefined
Invalid config:
- models.providers.google.baseUrl: Invalid input: expected string, received undefined
- models.providers.google.models: Invalid input: expected array, received undefined
Invalid config:
- models.providers.google.baseUrl: Invalid input: expected string, received undefined
- models.providers.google.models: Invalid input: expected array, received undefined
error: too many arguments for 'gateway'. Expected 0 arguments but got 1.```
proper narwhalBOT
#
      }
    }
  },
  "models": {
    "gemini": {
      "provider": "google",
      "model": "google/gemini-2.5-flash"
    }
  }
}

Option B: Full provider config (if you need custom settings)

{
#
  "models": {
    "providers": {
      "google": {
        "baseUrl": "https://generativelanguage.googleapis.com/v1beta",
        "apiKey": "GEMINI_API_KEY",
        "api": "google-generative-ai",
        "models": [
          {
            "id": "gemini-2.5-flash",
            "name": "Gemini 2.5 Flash",
            "api": "google-generative-ai",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
#
            "maxTokens": 65536
          }
        ]
      }
    }
  }
}

Also fix the restart command:

clawdbot gateway call restart

Delete the auth.profiles.google:* sections unless you're using OAuth. For API key mode, you don't need auth profiles. 🦐

vestal fox
#

Gateway call failed: Error: unknown method: restart

proper narwhalBOT
mild ruin
#

Did these suggestions work?

proper narwhalBOT
# mild ruin Did these suggestions work?

Based on the error messages and the FAQ, this looks like a Gemini API key issue. The "AI service returned an error" + "message ordering conflict" suggests the provider is failing, causing Clawdbot to reset the conversation.

Can you check a few things for @psychosassquatch?

  1. Is GEMINI_API_KEY actually set?

    clawdbot status
    

    This will show if the key is detected. If it shows "Shell env: off" for Gemini, the env var isn't being read.

  2. Verify the API key works directly:

    curl -H "Authorization: Bearer $GEMINI_API_KEY" \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash?key=$GEMINI_API_KEY"
    

    (Replace with their actual key if not using env var)