Skip to main content
This guide covers common issues you might encounter when using the HopX API and how to resolve them.

Authentication Issues

Invalid API key

Problem: Receiving 401 Unauthorized errors.
Solutions:
  1. Verify your API key is correct
  2. Check the Authorization header format: Authorization: Bearer $HOPX_API_KEY
  3. Ensure no extra spaces or newlines in the API key
  4. Generate a new API key from the dashboard

Expired JWT Token

Problem: VM Agent API returns 401 with expired token error. Solution: Refresh the JWT token using the Control Plane API:

Sandbox Creation Issues

Sandbox Stuck in “Creating” Status

Problem: Sandbox status remains “creating” for more than 2 minutes. Solutions:
  1. Wait up to 5 minutes for large templates
  2. Check template status - ensure it’s “active”
  3. Try a different region if available
  4. Delete and recreate the sandbox

Template Not Found

Problem: 404 Template not found when creating sandbox.
Solutions:
  1. List available templates to find valid IDs
  2. Use template name instead of ID
  3. Check if template is active

Resource Limits Exceeded

Problem: Cannot create more sandboxes.
Solutions:
  1. Delete unused sandboxes
  2. Upgrade your plan for higher limits
  3. Use sandbox pooling/reuse

Code Execution Issues

Execution Timeout

Problem: Code execution times out.
Solutions:
  1. Increase the timeout parameter
  2. Optimize your code
  3. Use background execution for long tasks

Import/Module Errors

Problem: Python packages not found.
Solutions:
  1. Install packages before use
  2. Use a template with pre-installed packages
  3. Check package spelling

File Operation Issues

Path Not Allowed

Problem: 403 Forbidden when accessing files.
Solutions:
  1. Only access allowed paths: /workspace, /tmp
  2. Use relative paths from allowed directories

File Not Found

Problem: File doesn’t exist when trying to read. Solutions:
  1. Check if file exists first
  2. Create the file before reading
  3. Verify the file path

Connection Issues

Network Timeout

Problem: Requests timing out. Solutions:
  1. Increase client timeout
  2. Check network connectivity
  3. Use retry logic with exponential backoff

SSL Certificate Errors

Problem: SSL verification failures. Solutions:
  1. Update your SSL certificates
  2. Update your HTTP client library
  3. Check system time (certificate validation depends on correct time)

Rate Limiting

Rate Limit Exceeded

Problem: 429 Too Many Requests errors.
Solutions:
  1. Implement exponential backoff
  2. Respect the retry_after header
  3. Distribute requests over time
  4. Cache responses when possible

Debugging Tips

Enable Verbose Logging

Check Request ID

Every response includes a request_id for debugging:
Include the request_id when contacting support.

Inspect Full Response

Test with cURL First

Before implementing in your application, test with cURL:

Getting Help

If you’re still experiencing issues:
  1. Check Status Page - https://status.hopx.dev
  2. Review Documentation - Complete API reference
  3. Contact Support - Include:
    • Request ID
    • Timestamp
    • Full error message
    • Code snippet (remove sensitive data)
    • Expected vs actual behavior

Common Patterns

Healthcheck Pattern

Cleanup Pattern

Next Steps