Troubleshooting Guide
This guide helps you diagnose and resolve common issues with the kagi CLI. It’s organized by symptom and error message for quick reference.Quick Diagnostic Steps
When encountering any issue, follow these steps first:- Check version:
kagi --version - Verify installation:
kagi --help - Test unauthenticated:
kagi news --limit 1 - Check auth status:
kagi auth status - Validate credentials:
kagi auth check
Installation Issues
”command not found” or “kagi is not recognized”
Symptoms:- Shell reports
kagi: command not found - PowerShell reports
kagi : The term '*kagi*' is not recognized
- Binary not in PATH
- Shell not reloaded after installation
- Installation didn’t complete
Permission Denied (macOS/Linux)
Symptoms:bash: /path/to/*kagi*: Permission denied
Windows Defender / SmartScreen Blocks Installation
Symptoms:- “Windows protected your PC” dialog
- “Unknown publisher” warning
- Click “More info”
- Click “Run anyway”
- Consider adding exclusion for the kagi directory
- Or use npm install as alternative:
npm install -g kagi-cli
Installation Script Fails
Symptoms:- Script exits with error
- “curl: (6) Could not resolve host”
Authentication Issues
”missing credentials” Error
Symptoms:- Variable name is
KAGI_SESSION_TOKENnotKAGI_TOKEN - Using
exportnot just assignment - No extra spaces around
=in export - Token is complete (not truncated)
“auth check failed” Error
Symptoms:- Token is invalid or expired
- Token was revoked
- Account doesn’t have required access
- Rate limit exceeded
- Log into kagi.com
- Check Settings → Account (for session token)
- Check Settings → API (for API token)
- Ensure token hasn’t been regenerated
- Generate new token in Kagi settings
- Update your configuration
- Test:
kagi auth check
- Verify subscription is active (for session token)
- Verify API credit is available (for API token)
“this command requires KAGI_API_TOKEN”
Symptoms:Environment Variable Not Being Used
Symptoms:- Set env var but
kagi auth statusshows “not configured” - Config file values overriding env vars (opposite of expected)
Session Link URL Not Working
Symptoms:- “Invalid token format” error
- Authentication fails with session token
Command Execution Issues
”No results found” or Empty Output
Symptoms:- Command runs but returns empty data array
- JSON shows
{ "data": [] }
- Wait a few minutes
- Reduce request frequency
- Check if using both tokens (fallback can help)
JSON Parse Errors
Symptoms:- Unexpected API response format
- Binary version incompatible with API
- Corrupted output
Slow Response Times
Symptoms:- Commands take 10+ seconds to complete
- Timeout errors
- Base search tries API first, then falls back
- If API is slow/down, fallback adds delay
- Set explicit token to skip fallback
- After many requests, service may slow responses
- Add delays between requests:
sleep 1
Command Hangs / No Output
Symptoms:- Command starts but never completes
- No output, no error
Platform-Specific Issues
macOS: “Cannot be opened because the developer cannot be verified”
Symptoms:- Gatekeeper blocks execution
- “macOS cannot verify that this app is free from malware”
- Go to System Preferences → Security & Privacy → General
- Click “Allow Anyway”
- Re-run command
Linux: “No such file or directory” despite file existing
Symptoms:lsshows file exists- Running it gives “No such file or directory”
Windows: PowerShell Execution Policy
Symptoms:Network and Connectivity Issues
Corporate Proxy / Firewall
Symptoms:- Commands fail with network errors
- Works on home network but not office network
DNS Resolution Failures
Symptoms:- “Could not resolve host: kagi.com”
- Works with IP but not hostname
TLS / Certificate Errors
Symptoms:- SSL certificate verification failed
- TLS handshake errors
Performance Issues
High Memory Usage
Symptoms:- kagi process uses excessive memory
- System slows down when using kagi
Binary Size Concerns
The kagi binary is self-contained and includes:- Rust runtime
- TLS certificates
- HTTP client libraries
- kagi binary: ~5-10 MB
- Equivalent Python + requests: ~50+ MB installed
Debugging Techniques
Enable Verbose Output
While kagi doesn’t have a--verbose flag, you can debug:
Test Authentication Directly
Isolate Issues
Test components separately:Collect Debug Information
When reporting issues, include:Error Reference Quick Guide
| Error Message | Likely Cause | Solution |
|---|---|---|
command not found | Not in PATH | Reload shell or add to PATH |
Permission denied | Not executable | chmod +x *kagi* |
missing credentials | No token set | Set KAGI_SESSION_TOKEN or KAGI_API_TOKEN |
auth check failed | Invalid token | Regenerate token in Kagi settings |
403 Forbidden | Auth issue | Check token validity |
No results found | Empty query result | Try different query |
failed to serialize | Version/API mismatch | Update kagi CLI |
Getting Help
If you’ve tried the solutions above and still have issues:- Check GitHub Issues: github.com/Microck/kagi-cli/issues
- Search existing issues for your error message
- Create a new issue with:
- kagi version (
kagi --version) - Operating system and version
- Installation method
- Complete error message
- Steps to reproduce
- Debug output (with tokens redacted)
- kagi version (
Common Gotchas
Token Confusion
- Session Token: For subscriber features (lens, assistant)
- API Token: For paid API (fastgpt, summarize, enrich)
- Both can exist, different commands need different ones
Variable Name Typos
KAGI_SESSION_TOKEN✓KAGI_SESSON_TOKEN✗KAGI_API_TOKEN✓KAGI_APITOKEN✗
Config File Location
- Repo checkout:
./.kagi.toml
Shell Syntax
Still stuck? Check the GitHub Issues or Discussions.