Skip to content

Troubleshooting

Solutions to common issues when using LeanJ.

Error: CLI not found or leanj: command not found

Solutions:

  1. Verify CLI is built:

    Terminal window
    ls dist/cli/leanj*
  2. Add to PATH:

  3. Set system property (for IDE):

    -Dleanj.cli.path=C:\path\to\leanj.exe

Error: Controller not running or controller fails to start

Solutions:

  1. Check ports are available:

    Terminal window
    # Windows
    netstat -ano | findstr :9876
    netstat -ano | findstr :9877
    # Linux/macOS
    lsof -i :9876
    lsof -i :9877
  2. Use different ports:

    Terminal window
    leanj controller start --port 8888
  3. Check Java installation:

    Terminal window
    java -version
  4. Verify controller JAR exists:

    Terminal window
    ls dist/controller/controller-1.0.0-SNAPSHOT.jar
  5. Run system check:

    Terminal window
    leanj doctor

Error: No JVMs found or JVM not found

Solutions:

  1. List all JVMs:

    Terminal window
    leanj jvms
  2. Check Java processes:

    Terminal window
    jps -l -v
  3. Verify JVM is running:

    • Check process list
    • Verify PID is correct
  4. Docker JVMs:

    • Ensure agent is configured in Dockerfile
    • Check container is running
    • Verify controller is accessible from container

Error: Attach failed or Failed to attach agent

Solutions:

  1. Run system check:

    Terminal window
    leanj doctor
  2. Verify tools.jar:

    • Check leanj doctor output
    • Ensure JDK (not just JRE) is installed
  3. Check JVM supports attach:

    • Some JVMs don’t support attach API
    • Try with different JVM
  4. Verify PID:

    Terminal window
    jps -l -v | grep <pid>
  5. Check permissions:

    • On Linux, may need same user or sudo
    • Check SELinux/AppArmor restrictions

Symptoms: No metrics in IDE, empty status

Solutions:

  1. Check controller is running:

    Terminal window
    leanj status
  2. Verify agent is attached:

    Terminal window
    leanj status
    # Should show attached JVMs
  3. Check controller logs:

    Terminal window
    # Windows
    Get-Content logs/profiler-controller.log -Tail 50
    # Linux/macOS
    tail -f logs/profiler-controller.log
  4. Verify agent configuration:

    • Check VM options include agent
    • Verify controller host/port
    • Check package filter

Error: Port already in use or Address already in use

Solutions:

  1. Find process using port:

    Terminal window
    # Windows
    netstat -ano | findstr :9876
    # Linux/macOS
    lsof -i :9876
  2. Kill process (if safe):

    Terminal window
    # Windows
    taskkill /PID <pid> /F
    # Linux/macOS
    kill -9 <pid>
  3. Use different ports:

    Terminal window
    leanj controller start --port 8888

Symptoms: No data from agent, connection errors in logs

Solutions:

  1. Check controller host/port:

    Terminal window
    # Verify in VM options
    -Dprofiler.controller.host=localhost
    -Dprofiler.controller.port=9876
  2. Test network connectivity:

    Terminal window
    # From container (if Docker)
    ping controller-host
    curl http://controller-host:9877/api/v1/status
  3. Check firewall rules:

    • Ensure ports 9876/9877 are open
    • Check Docker network configuration
  4. Verify agent JAR:

    Terminal window
    ls dist/agent/agent-core-1.0.0-SNAPSHOT.jar

Symptoms: Agent connected but no metrics visible

Solutions:

  1. Check package filter:

    Terminal window
    # Verify package matches your code
    -javaagent:agent.jar=package=com.myapp
  2. Verify methods are being called:

    • Ensure application is running
    • Check methods match package filter
  3. Check flush interval:

    Terminal window
    -Dprofiler.flush.interval.ms=1000
  4. Review controller logs:

    • Look for incoming snapshots
    • Check for errors

Symptoms: Application performance degraded

Solutions:

  1. Increase flush interval:

    Terminal window
    -Dprofiler.flush.interval.ms=5000
  2. Use CPU timer:

    Terminal window
    -Dprofiler.timer=cpu
  3. Narrow package filter:

    Terminal window
    # Instead of: package=com
    # Use: package=com.myapp.service
  4. Profile selectively:

    • Only profile when needed
    • Detach when not profiling

Symptoms: No inline hints in editor

Solutions:

  1. Enable CodeVision:

    • Settings → Editor → Inlay Hints
    • Enable Code Vision
    • Enable LeanJ
  2. Check profiling is active:

    • Run → Start LeanJ Profiling
    • Verify status in tool window
  3. Refresh IDE:

    • File → Invalidate Caches / Restart
    • Or restart IDE
  4. Check agent is attached:

    Terminal window
    leanj status

Error: CLI not found or plugin fails to start

Solutions:

  1. Set CLI path:

    -Dleanj.cli.path=C:\path\to\leanj.exe
  2. Add CLI to PATH:

    • Restart IDE after adding to PATH
  3. Verify CLI works:

    Terminal window
    leanj --version

Symptoms: Metrics are stale or not refreshing

Solutions:

  1. Check controller is receiving data:

    Terminal window
    leanj status
  2. Restart profiling:

    • Run → Start LeanJ Profiling
    • Or detach/reattach agent
  3. Check controller logs:

    • Look for broadcast messages
    • Verify IDE connection
  4. Refresh IDE:

    • Close and reopen files
    • Or restart IDE

Symptoms: Docker JVM not in jvms list

Solutions:

  1. Check agent configuration:

    ENV JAVA_TOOL_OPTIONS="-javaagent:/agent/agent.jar=package=com.myapp"
    ENV LEANJ_PROJECT=my-service
  2. Verify controller accessibility:

    Terminal window
    # From container
    curl http://controller-host:9877/api/v1/status
  3. Check network:

    • Use host.docker.internal (Docker Desktop)
    • Or shared Docker network
    • Or host IP address
  4. Review container logs:

    Terminal window
    docker logs <container>

Error: Connection refused from container

Solutions:

  1. Check controller host:

    ENV LEANJ_CONTROLLER_HOST=host.docker.internal
  2. Verify controller is running:

    Terminal window
    leanj status
  3. Test connectivity:

    Terminal window
    docker exec <container> ping controller-host
  4. Check firewall:

    • Ensure ports are open
    • Check Docker network rules

Error: License validation failed or Network error

Solutions:

  1. Check internet connection:

    Terminal window
    ping license-api.leanj.com
  2. Verify license key:

    Terminal window
    leanj license status
  3. Retry validation:

    Terminal window
    leanj license validate
  4. Check API URL:

    Terminal window
    echo $LEANJ_LICENSE_API_URL

Error: Rate limit exceeded

Solutions:

  1. Wait a few minutes:

    • License validation is cached for 24 hours
    • Wait before retrying
  2. Use cached license:

    • Offline mode uses cached data
    • Check ~/.leanj/license.json

Run comprehensive system check:

Terminal window
leanj doctor

Checks:

  • Java installation
  • Go installation
  • Controller JAR exists
  • Agent JAR exists
  • Tools.jar availability
  • Controller running status
  • Port availability

If issues persist:

  1. Check logs:

    • Controller: logs/profiler-controller.log
    • IntelliJ: Help → Show Log in Finder
  2. Run diagnostics:

    Terminal window
    leanj doctor
    leanj status
  3. Gather information:

    • Error messages
    • System configuration
    • Steps to reproduce
  4. Report issue: