Skip to main content

Quick Fixes Summary

Jump to the solution for common errors:
Error CodeQuick FixDetails
INVALID_API_KEYVerify API key in Settings → API KeysLink
SESSION_NOT_FOUNDCreate new session with POST /start/start-sessionLink
SESSION_EXPIREDSessions expire after maxDuration - create new oneLink
SESSION_LIMIT_REACHEDTerminate unused sessions or upgrade planLink
TASK_TIMEOUTIncrease maxDuration or simplify taskLink
TASK_ALREADY_RUNNINGWait for completion or stop with newState: “stop”Link
RATE_LIMIT_EXCEEDEDWait before retrying, implement exponential backoffLink
INSUFFICIENT_BALANCEAdd credits at enigma.click/billingLink
NAVIGATION_TIMEOUTRetry request or check if website is accessibleLink
ELEMENT_NOT_FOUNDRephrase task or wait for page loadLink

Error Response Format

All errors follow a consistent structure:
{
  "success": false,
  "error": "Human-readable error message",
  "code": "ERROR_CODE",
  "details": { /* Additional context */ }
}

HTTP Status Codes

StatusMeaningCommon Causes
200SuccessRequest completed successfully
400Bad RequestInvalid parameters, malformed JSON
401UnauthorizedMissing or invalid API key
402Payment RequiredInsufficient account balance
404Not FoundSession or task does not exist
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer-side issue
503Service UnavailableSystem maintenance or overload

Authentication Errors

INVALID_API_KEY

{
  "success": false,
  "error": "Invalid API key",
  "code": "INVALID_API_KEY"
}
Solution: Verify your API key is correct and active in Settings → API Keys. Related:

API_KEY_EXPIRED

{
  "success": false,
  "error": "API key has expired",
  "code": "API_KEY_EXPIRED"
}
Solution: Generate a new API key in your account settings. Related:

UNAUTHORIZED

{
  "success": false,
  "error": "Authorization header missing",
  "code": "UNAUTHORIZED"
}
Solution: Include Authorization: Bearer YOUR_API_KEY header in all requests. Example:
const response = await fetch("https://connect.enigma.click/start/start-session", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${YOUR_API_KEY}`
  },
  body: JSON.stringify({ taskDetails: "Navigate to example.com" })
});
Related:

Session Errors

SESSION_NOT_FOUND

{
  "success": false,
  "error": "Session a1b2c3d4e5f6 does not exist or has expired",
  "code": "SESSION_NOT_FOUND"
}
Causes:
  • Session was terminated
  • Session expired (5 min timeout)
  • Invalid sessionId
Solution: Create a new session with POST /start/start-session. Related:

SESSION_EXPIRED

{
  "success": false,
  "error": "Session expired after 300 seconds of inactivity",
  "code": "SESSION_EXPIRED"
}
Solution: Sessions expire after maxDuration. Create a new session for continuation. Best Practice:
// Set appropriate maxDuration
const session = await fetch("https://connect.enigma.click/start/start-session", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${apiKey}`
  },
  body: JSON.stringify({
    taskDetails: "Your task",
    maxDuration: 300000 // 5 minutes in milliseconds
  })
});
Related:

SESSION_LIMIT_REACHED

{
  "success": false,
  "error": "Maximum concurrent sessions reached (limit: 5)",
  "code": "SESSION_LIMIT_REACHED",
  "details": {
    "current": 5,
    "limit": 5
  }
}
Solution: Terminate unused sessions or upgrade your plan. Clean up sessions:
// Terminate session when done
await fetch("https://connect.enigma.click/start/send-message", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${apiKey}`
  },
  body: JSON.stringify({
    sessionId,
    message: { actionType: "state", newState: "terminate" }
  })
});
Related:

INSTANCE_UNAVAILABLE

{
  "success": false,
  "error": "No browser instances available",
  "code": "INSTANCE_UNAVAILABLE"
}
Solution: Wait and retry, or contact support if persistent. Retry with backoff:
async function createSessionWithRetry(taskDetails, apiKey, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      const response = await fetch("https://connect.enigma.click/start/start-session", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "Authorization": `Bearer ${apiKey}`
        },
        body: JSON.stringify({ taskDetails })
      });

      const data = await response.json();
      if (response.ok) return data;

      if (data.code === "INSTANCE_UNAVAILABLE" && i < maxRetries - 1) {
        await new Promise(r => setTimeout(r, 2000 * Math.pow(2, i)));
        continue;
      }

      throw new Error(data.error);
    } catch (error) {
      if (i === maxRetries - 1) throw error;
    }
  }
}

Task Execution Errors

TASK_NOT_FOUND

{
  "success": false,
  "error": "Task x9y8z7w6v5u4 not found in session a1b2c3d4e5f6",
  "code": "TASK_NOT_FOUND"
}
Solution: Verify taskId and sessionId are correct. Related:

TASK_ALREADY_RUNNING

{
  "success": false,
  "error": "A task is already running in this session",
  "code": "TASK_ALREADY_RUNNING"
}
Solution: Wait for current task to complete or stop it with newState: "stop". Stop running task:
await fetch("https://connect.enigma.click/start/send-message", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${apiKey}`
  },
  body: JSON.stringify({
    sessionId,
    message: { actionType: "state", newState: "stop" }
  })
});
Related:

TASK_TIMEOUT

{
  "success": false,
  "error": "Task exceeded maximum duration of 60000ms",
  "code": "TASK_TIMEOUT",
  "usage": {
    "inputTokens": 25000,
    "outputTokens": 8000,
    "cost": 0.0245
  }
}
Solution: Increase maxDuration or simplify the task. Adjust timeouts:
const response = await fetch("https://connect.enigma.click/start/run-task", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${apiKey}`
  },
  body: JSON.stringify({
    sessionId,
    taskDetails: "Complex task",
    maxDuration: 120000 // 2 minutes
  })
});
Related:

INVALID_TASK_DETAILS

{
  "success": false,
  "error": "taskDetails cannot be empty",
  "code": "INVALID_TASK_DETAILS"
}
Solution: Provide a valid task description. Good task examples:
// Good - specific and actionable
taskDetails: "Navigate to example.com and click the 'Sign Up' button"

// Good - clear objective
taskDetails: "Search for 'laptop' on amazon.com and get the price of the first result"

// Bad - too vague
taskDetails: "do something"
Related:

Browser & Navigation Errors

{
  "success": false,
  "error": "Navigation timeout after 30 seconds",
  "code": "NAVIGATION_TIMEOUT",
  "details": {
    "url": "https://example.com",
    "timeout": 30000
  }
}
Causes:
  • Slow website
  • Network issues
  • Website blocking automated access
Solution:
  • Retry the request
  • Check if website is accessible
  • Use startingUrl if navigating to a specific page
Example:
const session = await fetch("https://connect.enigma.click/start/start-session", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${apiKey}`
  },
  body: JSON.stringify({
    taskDetails: "Click the login button",
    startingUrl: "https://example.com/login" // Start directly at destination
  })
});
Related:

PAGE_CRASH

{
  "success": false,
  "error": "Browser page crashed during execution",
  "code": "PAGE_CRASH"
}
Solution: Retry the task. If persistent, report to support with session details. Related:

ELEMENT_NOT_FOUND

{
  "success": false,
  "error": "Could not locate element matching criteria",
  "code": "ELEMENT_NOT_FOUND"
}
Causes:
  • Page structure changed
  • Element inside iframe
  • Element not yet loaded
Solution: Rephrase task description or wait for page load. Tips:
// Instead of: "Click the button"
// Try: "Click the blue 'Submit' button at the bottom of the form"

// For dynamic content:
taskDetails: "Wait for the results to load, then click the first product"
Related:

Rate Limiting & Network Errors

RATE_LIMIT_EXCEEDED

{
  "success": false,
  "message": "Rate limit exceeded. Please try again later."
}
Solution: Wait before retrying. Implement exponential backoff. Rate Limits by Endpoint:
  • POST /start/start-session: 10 requests/minute per user
  • POST /start/send-message: 10 requests/minute per user
  • POST /start/run-task: 10 requests/minute per user
  • GET /task/:sessionId/:taskId: No rate limit
Note: Rate limits are per user (API key owner), not per API key. Exponential Backoff Implementation:
async function makeRequestWithRetry(url, options, maxRetries = 3) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    try {
      const response = await fetch(url, options);
      const data = await response.json();

      if (response.ok) return data;

      // Don't retry client errors (4xx) except rate limits
      if (response.status >= 400 && response.status < 500 && response.status !== 429) {
        throw new Error(`${data.code}: ${data.error}`);
      }

      // Retry on 5xx errors and rate limits
      if (attempt < maxRetries - 1) {
        const delay = Math.min(1000 * Math.pow(2, attempt), 10000);
        console.log(`Retry ${attempt + 1}/${maxRetries} after ${delay}ms`);
        await new Promise(r => setTimeout(r, delay));
        continue;
      }

      throw new Error(`${data.code}: ${data.error}`);

    } catch (error) {
      if (attempt === maxRetries - 1) throw error;
    }
  }
}
Related:

Billing & Payment Errors

INSUFFICIENT_BALANCE

{
  "success": false,
  "error": "Insufficient account balance ($0.50 remaining, $2.00 required)",
  "code": "INSUFFICIENT_BALANCE",
  "details": {
    "balance": 0.50,
    "required": 2.00
  }
}
Solution: Add credits to your account at enigma.click/billing. Monitor balance:
  • Check your balance regularly in the dashboard
  • Set up low balance alerts
  • Consider auto-recharge options
Related:

PAYMENT_FAILED

{
  "success": false,
  "error": "Payment method declined",
  "code": "PAYMENT_FAILED"
}
Solution: Update payment method in Settings → Billing. Common causes:
  • Expired card
  • Insufficient funds
  • Card issuer declined
  • Invalid billing address

Validation Errors

INVALID_PARAMETER

{
  "success": false,
  "error": "Invalid parameter 'maxDuration': must be between 1000 and 300000",
  "code": "INVALID_PARAMETER",
  "details": {
    "parameter": "maxDuration",
    "value": 500000,
    "min": 1000,
    "max": 300000
  }
}
Solution: Check parameter requirements in API documentation. Parameter Ranges:
  • maxDuration: 1,000 - 300,000 ms (1 second - 5 minutes)
  • maxInputTokens: 1,000 - 100,000 tokens
  • maxOutputTokens: 100 - 50,000 tokens
Related:

MISSING_REQUIRED_FIELD

{
  "success": false,
  "error": "Missing required field: taskDetails",
  "code": "MISSING_REQUIRED_FIELD",
  "details": {
    "field": "taskDetails"
  }
}
Solution: Include all required fields in request body. Required fields by endpoint: POST /start/start-session:
  • taskDetails (string)
POST /start/send-message:
  • sessionId (string)
  • message (object)
POST /start/run-task:
  • sessionId (string)
  • taskDetails (string)
Related:

MCP-Specific Errors

MCP_SESSION_NOT_FOUND

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32603,
    "message": "Session not found"
  }
}
Solution: Check your MCP session ID or reconnect to the SSE endpoint. Related:

MCP_METHOD_NOT_FOUND

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32601,
    "message": "Method not found: invalid_method"
  }
}
Solution: Use valid MCP methods (tools/list, tools/call, etc.). Valid MCP methods:
  • tools/list
  • tools/call
  • resources/list
  • resources/read
Related:

MCP_INVALID_REQUEST

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32600,
    "message": "Invalid request"
  }
}
Solution: Ensure request follows JSON-RPC 2.0 format with jsonrpc: "2.0". Example:
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list",
  "params": {}
}
Related:

Error Handling Best Practices

Complete Error Handling Example

async function robustTaskExecution(taskDetails, apiKey) {
  let sessionId = null;

  try {
    // Create session with retry
    const session = await makeRequestWithRetry(
      "https://connect.enigma.click/start/start-session",
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "Authorization": `Bearer ${apiKey}`
        },
        body: JSON.stringify({ taskDetails })
      }
    );

    sessionId = session.sessionId;

    // Execute task with guardrail handling
    const result = await executeTaskWithGuardrails(
      sessionId,
      taskDetails,
      apiKey
    );

    return result;

  } catch (error) {
    console.error("Task execution failed:", error.message);

    // Clean up session on error
    if (sessionId) {
      await terminateSession(sessionId, apiKey);
    }

    throw error;
  }
}

async function terminateSession(sessionId, apiKey) {
  try {
    await fetch("https://connect.enigma.click/start/send-message", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${apiKey}`
      },
      body: JSON.stringify({
        sessionId,
        message: { actionType: "state", newState: "terminate" }
      })
    });
  } catch (error) {
    console.error("Failed to terminate session:", error.message);
  }
}

Handling Guardrails

async function executeTaskWithGuardrails(sessionId, taskDetails, apiKey) {
  let attempts = 0;
  const maxGuardrailAttempts = 3;

  while (attempts < maxGuardrailAttempts) {
    const result = await pollForResult(sessionId, taskId, apiKey);

    if (result.type === "task_completed") {
      return result;
    }

    if (result.type === "guardrail_trigger") {
      console.log(`Guardrail triggered: ${result.data.value}`);

      // Get user input
      const userInput = await promptUser(result.data.value);

      // Resume with input
      await fetch("https://connect.enigma.click/start/send-message", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "Authorization": `Bearer ${apiKey}`
        },
        body: JSON.stringify({
          sessionId,
          message: {
            actionType: "guardrail",
            taskDetails: userInput,
            newState: "resume"
          }
        })
      });

      attempts++;
      continue;
    }

    throw new Error("Unexpected result type");
  }

  throw new Error("Maximum guardrail attempts exceeded");
}
Related:

Debugging Checklist

When encountering issues:
  • Verify API key is valid and has correct permissions
  • Check account balance is sufficient
  • Confirm session/task IDs are correct
  • Review task instructions for clarity
  • Check network connectivity
  • Look for error codes in responses
  • Enable verbose logging
  • Test with simpler task first
  • Check system status page
  • Review usage limits for your plan

Getting Help

If you’re still experiencing issues:
  1. Documentation: Review relevant API docs
  2. Status Page: Check status.enigma.click
  3. Support: Email support@enigma.click with:
    • Error code and full error response
    • Session ID and task ID
    • Task description
    • Timestamp of occurrence
    • Steps to reproduce