#Gemini keeps failing to connect
1 messages · Page 1 of 1 (latest)
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:
-
Model name format — Make sure you're using the correct format. The docs use
google/gemini-1.5-flashorgoogle/gemini-pro— not justgemini-pro -
API key location — Your config should have the key under the Google provider:
"google": {
"apiKey": "YOUR_GEMINI_API_KEY"
}
-
Model config — Under
models, make sure it points to the Google provider:"models": { "gemini": { "provider": "google", "model": "google/gemini-1.5-flash" } } -
Region availability — Some Gemini models aren't available in all regions. Try
google/gemini-1.5-flashfirst 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!
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?
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 format — google/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-progoogle/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! 🦐
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-progoogle/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. 🦐
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! 🦐
Gateway call failed: Error: invalid config.apply params: data must have required property 'raw'
Oops, that's an internal command format. For manual restarts, just restart the entire Clawdbot process:
# Find and kill the process, then restart
pkill -f clawdbot
clawdbot
Or if you used systemd/supervisord:
sudo systemctl restart clawdbot
# or
sudo svc -t /path/to/clawdbot
Simpler approach: Just restart your terminal/session where clawdbot is running, or if it's in a tmux session:
tmux kill-session -t clawdbot
clawdbot
Once it's back up with the corrected config, try Gemini again! 🦐
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! 🦐
{
"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
}
}
}
Your config looks correct now! The model is set to google/gemini-1.5-flash which should work.
Quick checks:
-
Did you actually edit the config file at
~/.clawdbot/clawdbot.json? The config you shared looks right, but just confirming you saved it. -
API key location — Your
auth.profiles.google:defaultpoints to api_key mode, but where's the actual key? It should be in:- Environment variable:
GOOGLE_API_KEY - Or in
~/.clawdbot/credentials.jsonundergoogle:default
- Environment variable:
-
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.
- Try a different model —
google/gemini-1.0-prois 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? 🦐
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"
}
}
Based on the docs, I found the issue! 🎯
Your config has google:default set to mode: "api_key", but the actual API key isn't configured anywhere. For API key mode, you need to either:
Option 1: Set the environment variable
export GEMINI_API_KEY="your_actual_api_key_here"
Option 2: Add it to your config
{
"models": {
"providers": {
"google": {
"apiKey": "your_actual_api_key_here"
}
}
}
}
Also, you have a profile conflict:
google:manual→mode: "token"(needs OAuth token)google:default→mode: "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! 🦐
- 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.```
The issue is you're mixing full provider config with shorthand. For Google/Gemini, you have two options:
Option A: Simple (recommended) - Just use the API key
Remove the provider config entirely and just set the env var:
export GEMINI_API_KEY="your_key_here"
Your config should be minimal:
{
"agents": {
"defaults": {
"model": {
"primary": "google/gemini-2.5-pro"
}
}
},
"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. 🦐
Gateway call failed: Error: unknown method: restart
The correct command is:
clawdbot daemon restart
Or if that doesn't work:
clawdbot gateway --force
This will stop and restart the gateway process so your new config takes effect. 🦐
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?
-
Is
GEMINI_API_KEYactually set?clawdbot statusThis will show if the key is detected. If it shows "Shell env: off" for Gemini, the env var isn't being read.
-
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)