Clay logo

LeadMagic has made more than one billion API calls with Clay and won The Unstoppable Wheel award.

Recap
LeadMagicDocs

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

Interactive LeadMagic CLI features use secure browser sign-in: you do not set a LeadMagic apiKey for normal use.

Error: Session expired or token refresh failed

OAuth tokens expire; the CLI refreshes automatically when possible.

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

Or check for orphaned processes: ps aux | grep lm

Exports in .leadmagic/export/ survive reset.

File and Data Issues

RowsBehavior
1–5,000Normal
5,001–10,000Warning prompt
10,001+Hard stop

Split files, filter with SQL, use recipes on subsets, or call the REST API for very large batches.

Prefer UTF-8. Delimiters (comma, tab, semicolon, pipe) are auto-detected in most cases.

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

  1. Check network connectivity
  2. Confirm login: lm whoami / lm credits
  3. Status: leadmagic.io/status

Chat requires a TTY. Non-interactive shells (piped CI) will fail: use a real terminal.

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

ErrorCauseSolution
Authentication requiredNo OAuth sessionlm login
Session expiredToken expiredlm login
Database is lockedAnother process holds the locklm db unlock
File exceeds row limitCSV > 10,000 rowsSplit file or use API
Insufficient creditsBalance emptyBilling
Insufficient credits. This request needs up to N credits.Balance too low for the AI reply's credit holdAdd credits at Billing, or use a shorter request
Daily AI spend limit reached.Your user or organization AI budget for today is usedWait for the reset (00:00 UTC) shown in the message
Command not found: lmNot on PATHNew terminal or source ~/.zshrc
Non-interactive TTYChat needs a terminalRun outside pipes/CI

Reset Everything

This keeps exports under .leadmagic/export/ but clears loaded data and session config.

Still Need Help?