Troubleshoot LeadMagic CLI
Fix LeadMagic CLI installation, sign-in, terminal compatibility, local data, connected services, and debug logging.
Use lm doctor first when the installed LeadMagic CLI workspace, its lm command, authentication, local database, or terminal rendering is not working as expected.
Quick Diagnostics
lm doctor checks installation, PATH, configuration, sign-in, local data, connected services, and more. Fixable issues are repaired by default; use --check-only to skip repairs.
Debug Logging
Or:
Authentication Issues
Not logged in / authentication required
Not logged in / authentication required
Interactive LeadMagic CLI features use secure browser sign-in: you do not set a LeadMagic apiKey for normal use.
Session expired
Session expired
Error: Session expired or token refresh failed
OAuth tokens expire; the CLI refreshes automatically when possible.
Login browser doesn't open
Login browser doesn't open
Copy the URL printed in the terminal and open it in any browser. After auth, the CLI picks up the session.
Headless/SSH environments may need this manual step.
Database Issues
Database locked
Database locked
Or check for orphaned processes: ps aux | grep lm
Database corruption
Database corruption
Exports in .leadmagic/export/ survive reset.
Database too large
Database too large
File and Data Issues
File too large
File too large
| Rows | Behavior |
|---|---|
| 1–5,000 | Normal |
| 5,001–10,000 | Warning prompt |
| 10,001+ | Hard stop |
Split files, filter with SQL, use recipes on subsets, or call the REST API for very large batches.
CSV parsing errors
CSV parsing errors
Prefer UTF-8. Delimiters (comma, tab, semicolon, pipe) are auto-detected in most cases.
Columns not detected
Columns not detected
Pass --email-column, --first-name-column, etc. to lm enrich, or tell chat which columns to use. Run lm analyze to see detections.
Connection Issues
API request failed
API request failed
- Check network connectivity
- Confirm login:
lm whoami/lm credits - Status: leadmagic.io/status
AI chat not responding
AI chat not responding
Chat requires a TTY. Non-interactive shells (piped CI) will fail: use a real terminal.
MCP client not configured
MCP client not configured
Doctor may warn that no Claude/Cursor/VS Code MCP config was found. Install from the LeadMagic MCP setup guide or see MCP setup.
Common Error Messages
| Error | Cause | Solution |
|---|---|---|
Authentication required | No OAuth session | lm login |
Session expired | Token expired | lm login |
Database is locked | Another process holds the lock | lm db unlock |
File exceeds row limit | CSV > 10,000 rows | Split file or use API |
Insufficient credits | Balance empty | Billing |
Insufficient credits. This request needs up to N credits. | Balance too low for the AI reply's credit hold | Add credits at Billing, or use a shorter request |
Daily AI spend limit reached. | Your user or organization AI budget for today is used | Wait for the reset (00:00 UTC) shown in the message |
Command not found: lm | Not on PATH | New terminal or source ~/.zshrc |
| Non-interactive TTY | Chat needs a terminal | Run outside pipes/CI |
Reset Everything
Still Need Help?
Was this page helpful?
We value your feedback.