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 - Run the auth wizard on a TTY:
kagi auth - Check auth status:
kagi auth status - Validate credentials:
kagi auth check
Reading Contextual Errors
Recent kagi builds include more context in failed HTTP operations. Use these details before retrying blindly:HTTP 401orHTTP 403usually means the API token or session token was rejected. Runkagi authand paste a fresh token from Kagi settings.; response body: ...is a short server diagnostic. It can explain account state, insufficient credit, rate limits, or an expired session.request to https://...identifies the Kagi surface that failed. This helps separate Search API issues from subscriber web-product issues.batch query failed (N succeeded): query: errormeans only the listed batch entries failed. Retry those entries directly or lower--concurrencyif the body mentions rate limits.
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 both session token and API key are configured (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 only falls back when you have opted into API-first mode with
[auth.preferred_auth] = "api" - If the API path is slow or rejected, the session fallback adds delay
- Leave base search on the default session-first behavior if you want to avoid that extra hop
- 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 credential set | Set KAGI_SESSION_TOKEN, KAGI_API_KEY, or KAGI_API_TOKEN depending on the command |
kagi auth is interactive on TTYs | Bare kagi auth was run in CI, a pipe, or another non-interactive environment | Use kagi auth set, kagi auth status, or kagi auth check instead |
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 Key: For current paid API commands (search, extract)
- Legacy API Token: For older paid API commands (fastgpt, summarize, enrich)
- All three can exist, different commands need different ones
Bare kagi auth Fails in a Script
Symptom:
kagi auth is the interactive onboarding wizard. It is meant for real terminals, not pipes or CI jobs.
Fix:
Use one of the explicit non-interactive subcommands:
Variable Name Typos
KAGI_SESSION_TOKEN✓KAGI_SESSON_TOKEN✗KAGI_API_KEY✓KAGI_API_TOKEN✓KAGI_APITOKEN✗
Config File Location
- Repo checkout:
./.kagi.toml
Shell Syntax
Still stuck? Check the GitHub Issues or Discussions.