Failed to read config at /home/ubuntu/.clawdbot/clawdbot.json MissingEnvVarError: Missing env var "GEMINI_API_KEY" referenced at config path: models.providers.gemini.apiKey
at substituteString (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js:76:31)
at substituteAny (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js:91:16)
at substituteAny (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js💯27)
at substituteAny (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js💯27)
at substituteAny (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js💯27)
at substituteAny (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js💯27)
at resolveConfigEnvVars (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js:116:12)
at Object.loadConfig (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/io.js:169:33)
at Module.loadConfig (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/io.js:459:51)
at resolveSettings (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/logging/logger.js:34:38) {
varName: 'GEMINI_API_KEY',
configPath: 'models.providers.gemini.apiKey'
#API key
1 messages · Page 1 of 1 (latest)
@drowsy belfry
@drowsy belfry need help: Failed to read config at /home/ubuntu/.clawdbot/clawdbot.json MissingEnvVarError: Missing env var "GEMINI_API_KEY" referenced at config path: models.providers.gemini.apiKey
at substituteString (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js:76:31)
at substituteAny (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js:91:16)
at substituteAny (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js💯27)
at substituteAny (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js💯27)
at substituteAny (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js💯27)
at substituteAny (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js💯27)
at resolveConfigEnvVars (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/env-substitution.js:116:12)
at Object.loadConfig (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/io.js:169:33)
at Module.loadConfig (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/io.js:459:51)
at resolveSettings (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/logging/logger.js:34:38) {
varName: 'GEMINI_API_KEY',
configPath: 'models.providers.gemini.apiKey'
The error is clear — Clawdbot is looking for the GEMINI_API_KEY environment variable but can't find it.
To fix this:
Set the environment variable before starting Clawdbot:
export GEMINI_API_KEY="your-api-key-here"
clawdbot start
Or add it to your shell profile (~/.bashrc, ~/.zshrc, etc.) for persistence:
echo 'export GEMINI_API_KEY="your-api-key-here"' >> ~/.bashrc
source ~/.bashrc
Docs reference: https://docs.clawd.bot/configuration/environment-variables
The ${...} syntax in config means "load from environment," so make sure the var is exported in the same shell where you run Clawdbot.
can you make it so it starts with OpenAI instead
Yes — just update their ~/.clawdbot/clawdbot.json:
Either:
Option 1: Remove Gemini provider (if you don't need it):
{
"models": {
"providers": {
"gemini": null
}
}
}
Option 2: Switch to OpenAI (set the OPENAI_API_KEY env var):
export OPENAI_API_KEY="sk-..."
Then in their config, make sure the provider order or default uses OpenAI.
If they want to completely remove Gemini and use OpenAI only, they should check their config structure and set OPENAI_API_KEY in their environment (or .env file) instead of GEMINI_API_KEY.
I am running on aws what should I put in
Quick options for AWS:
1. Add to .bashrc (simplest)
echo 'export OPENAI_API_KEY="sk-..."' >> ~/.bashrc
source ~/.bashrc
2. Use .env file (recommended)
Create ~/.clawdbot/.env:
OPENAI_API_KEY=sk-your-key-here
Then either:
source ~/.clawdbot/.envbefore running clawdbot- Or set clawdbot to load it:
clawdbot start --env-file ~/.clawdbot/.env
3. More secure: AWS Systems Manager Parameter Store
Store the key securely, fetch at runtime:
aws ssm get-parameter --name "clawnotify-api-key" --with-decryption --query Parameter.Value --output text
Add to .bashrc or user data for persistent setup.
Docs: https://docs.clawd.bot/configuration/environment-variables
If they're using a systemd service, add Environment=OPENAI_API_KEY=sk-... to the service file.
So when I start the aws should I write what’s in option 1?
Yes, run these 2 commands on your AWS instance:
echo 'export OPENAI_API_KEY="sk-your-actual-openai-key-here"' >> ~/.bashrc
source ~/.bashrc
Replace sk-your-actual-openai-key-here with their real OpenAI API key.
Then restart clawdbot:
clawdbot restart
That's it! 🦐
The error is about GEMINI_API_KEY, not OpenAI. You need to either:
Option A: Set the Gemini key (if you want Gemini)
export GEMINI_API_KEY="your-gemini-key"
Option B: Remove Gemini from config (easiest)
Edit ~/.clawdbot/clawdbot.json and remove the gemini section:
nano ~/.clawdbot/clawdbot.json
Look for "gemini" and delete/comment out that block.
Then restart clawdbot:
clawdbot restart
Check your config first — run:
cat ~/.clawdbot/clawdbot.json
Run this to edit the config:
nano ~/.clawdbot/clawdbot.json
Find the "gemini" section (looks like this) and delete it or set it to null:
"gemini": null
Or comment it out:
// "gemini": {
// "apiKey": "${GEMINI_API_KEY}",
// ...
// }
Save (Ctrl+O, Enter, Ctrl+X).
Then restart:
clawdbot restart
now i have this: Failed to read config at /home/ubuntu/.clawdbot/clawdbot.json SyntaxError: JSON5: invalid character '"' at 31:9
at syntaxError (/home/ubuntu/.npm-global/lib/node_modules/clawdbot/node_modules/json5/lib/parse.js:1110:17)
at invalidChar (/home/ubuntu/.npm-global/lib/node_modules/clawdbot/node_modules/json5/lib/parse.js:1055:12)
at Object.afterPropertyValue (/home/ubuntu/.npm-global/lib/node_modules/clawdbot/node_modules/json5/lib/parse.js:676:15)
at Object.default (/home/ubuntu/.npm-global/lib/node_modules/clawdbot/node_modules/json5/lib/parse.js:168:37)
at lex (/home/ubuntu/.npm-global/lib/node_modules/clawdbot/node_modules/json5/lib/parse.js💯42)
at Object.parse (/home/ubuntu/.npm-global/lib/node_modules/clawdbot/node_modules/json5/lib/parse.js:25:17)
at Object.loadConfig (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/io.js:162:39)
at Module.loadConfig (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/config/io.js:459:51)
at resolveSettings (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/logging/logger.js:34:38)
at getLogger (file:///home/ubuntu/.npm-global/lib/node_modules/clawdbot/dist/logging/logger.js:84:22) {
lineNumber: 31,
columnNumber: 9
@drowsy belfry
You broke the JSON syntax. Let's fix it:
Show me what's in the file:
cat ~/.clawdbot/clawdbot.json
Or just restore a minimal working config:
cat > ~/.clawdbot/clawdbot.json << 'EOF'
{
"models": {
"providers": {
"openai": {
"apiKey": "${OPENAI_API_KEY}"
}
What's the error now? Did you run the restore command and set the OpenAI key?
},
"default": "openai/gpt-4o"
}
}
EOF
Then restart:
clawdbot restart
Make sure you also set the env var:
export OPENAI_API_KEY="sk-your-key"
echo 'export OPENAI_API_KEY="sk-your-key"' >> ~/.bashrc
→ npm install failed; cleaning up and retrying...
That's a dependency install issue. Try:
# Clear cache and reinstall
npm cache clean --force
clawdbot restart
If it still fails, check which package is failing:
clawdbot --version
Then try a full reinstall:
sudo npm install -g clawdbot@latest
whats the difference open ai codex and api key?
clawdbot restart
how do I change model
Let's diagnose. Run:
# Check disk space
df -h
# Check Node version
node --version
# Check npm version
npm --version
# Check if clawdbot is partially installed
ls -la ~/.npm-global/lib/node_modules/clawdbot/
Common fixes:
OpenAI API key = access to GPT models (GPT-4, GPT-3.5)
Codex = a separate CLI tool for code generation. It uses its own key or can use your OpenAI API key.
For Clawdbot: You just need an OpenAI API key (sk-...). Nothing else.
Get one here: https://platform.openai.com/api-keys
Then:
export OPENAI_API_KEY="sk-your-key"
echo 'export OPENAI_API_KEY="sk-your-key"' >> ~/.bashrc
clawdbot restart
Still stuck on the npm install? Run these commands and paste the output:
df -h
node --version
npm --version
This will help me figure out why the install is failing.
Disk full?
sudo apt-get clean
sudo apt-get autoremove
Permission issue?
sudo npm install -g clawdbot@latest
Node version too old/new?
Clawdbot needs Node 18+. Check:
node --version
What's the output of these commands?
Change the default model in ~/.clawdbot/clawdbot.json:
nano ~/.clawdbot/clawdbot.json
Find the models.default line and change it:
{
"models": {
"default": "openai/gpt-4o-mini"
}
}
Or per-message in Discord: