🔧Troubleshooting

Comprehensive guide to solving common issues with Somnia AI Agent Kit.

📋 Table of Contents


🔨 Installation Issues

Problem: npm install fails

Symptoms:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree

Solutions:

  1. Clear npm cache:

  1. Use legacy peer deps:

  1. Update npm:

  1. Try pnpm instead:

Problem: TypeScript errors during installation

Symptoms:

Solutions:

  1. Install TypeScript:

  1. Check tsconfig.json:

  1. Rebuild TypeScript:

Problem: Module not found at runtime

Symptoms:

Solutions:

  1. Verify installation:

  1. Reinstall package:

  1. Check node_modules:


⚙️ Configuration Problems

Problem: Environment variables not loading

Symptoms:

Solutions:

  1. Check .env file exists:

  1. Load dotenv:

  1. Check .env format:

  1. Verify .env location:

Problem: Wrong network configuration

Symptoms:

Solutions:

  1. Verify network:

  1. Check contract addresses:

  1. Test RPC connection:

Problem: Invalid private key

Symptoms:

Solutions:

  1. Check format:

  1. Validate private key:

  1. Generate new key:


⛓️ Blockchain & Transaction Errors

Problem: Insufficient funds for gas

Symptoms:

Solutions:

  1. Check balance:

  1. Get testnet tokens:

  1. Estimate gas before transaction:

Problem: Transaction reverted

Symptoms:

Solutions:

  1. Check revert reason:

  1. Common revert reasons:

  1. Debug with Hardhat:

Problem: Nonce too low

Symptoms:

Solutions:

  1. Reset nonce:

  1. Wait for pending transactions:

  1. Use transaction queue:

Problem: Transaction timeout

Symptoms:

Solutions:

  1. Increase timeout:

  1. Check transaction status:

  1. Speed up transaction:


🤖 LLM & AI Issues

Problem: OpenAI API key invalid

Symptoms:

Solutions:

  1. Verify API key:

  1. Test API key:

  1. Check API quota:

Problem: Rate limit exceeded

Symptoms:

Solutions:

  1. Implement exponential backoff:

  1. Implement request queue:

  1. Use multiple API keys:

Problem: Ollama connection failed

Symptoms:

Solutions:

  1. Check Ollama is running:

  1. Verify Ollama URL:

  1. Pull model if missing:

Problem: LLM response too slow

Symptoms:

  • Responses take >10 seconds

  • Timeouts occur frequently

Solutions:

  1. Use streaming:

  1. Reduce max tokens:

  1. Use faster models:

  1. Cache responses:


📝 Smart Contract Errors

Problem: Agent not found

Symptoms:

Solutions:

  1. Verify agent ID:

  1. List your agents:

  1. Check agent status:

Problem: Not agent owner

Symptoms:

Solutions:

  1. Verify ownership:

  1. Use correct wallet:

Problem: Vault daily limit exceeded

Symptoms:

Solutions:

  1. Check available amount:

  1. Wait for reset:

  1. Increase limit:


⚡ Performance Issues

Problem: Slow agent responses

Diagnosis:

Solutions:

  1. Parallel operations:

  1. Cache frequently used data:

  1. Batch operations:

Problem: High memory usage

Diagnosis:

Solutions:

  1. Clear caches periodically:

  1. Limit conversation history:

  1. Stream large responses:


🔍 Debugging Tools

Enable Debug Logging

Transaction Explorer

View transactions on block explorer:

Network Inspector

Contract Event Monitoring


🆘 Still Need Help?

If you're still experiencing issues:

  1. Check logs: Enable verbose logging

  2. Ask community: Discordarrow-up-right

  3. Contact support: support@somnia.network

When reporting issues, include:

  • Error message (full stack trace)

  • Code snippet (minimal reproducible example)

  • Environment (OS, Node version, package versions)

  • Steps to reproduce

  • Expected vs actual behavior


Happy debugging! 🐛🔨

Last updated