Search anything...
K
Back to Docs
  • Introduction
  • Quick Start
  • Account Setup
  • AI Studio
  • Chat
  • Agents
  • Voice
  • MCP Servers
  • Workflows
  • Authentication
  • Studio API
  • Chat API
  • Agents API
  • Voice API
  • Workflows API
  • Webhooks
  • Error Codes
  • Creating Custom Agents
  • MCP Integration
  • Building Workflows
  • Prompt Engineering
  • Team Management
  • Billing & Plans
  • Usage Monitoring
  • Single-Tenant Cloud
  • Private VPC Deployment
  • SSO Configuration
  • Security Policies
  • Compliance
  • Troubleshooting
  • API Versioning
DocsAPI ReferenceError Codes

Error Codes

Complete error code reference

This document provides a comprehensive reference for all error codes returned by the Girard AI API.

Response Format

All API responses follow a consistent format:

Success Response

{
  "success": true,
  "data": { ... },
  "meta": {
    "requestId": "req_abc123",
    "page": 1,
    "limit": 20,
    "total": 100
  }
}

Error Response

{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": { ... },
    "hint": "Suggestion for fixing the error"
  },
  "meta": {
    "requestId": "req_abc123"
  }
}

Authentication Errors (401)

These errors indicate problems with API authentication.

CodeHTTP StatusDescriptionResolution
MISSING_API_KEY401No API key provided in requestAdd Authorization: Bearer gai_sk_... header
INVALID_API_KEY401API key format is invalid or key doesn't existVerify the API key is correct and active
EXPIRED_API_KEY401API key has passed its expiration dateGenerate a new API key in the dashboard
REVOKED_API_KEY401API key has been manually revokedGenerate a new API key or contact admin

Example

# Missing API key
curl https://api.girardai.com/v1/workflows

# Response
{
  "success": false,
  "error": {
    "code": "MISSING_API_KEY",
    "message": "API key is required",
    "hint": "Add Authorization header with format: Bearer gai_sk_..."
  }
}

Authorization Errors (403)

These errors indicate the API key is valid but lacks permission for the requested action.

CodeHTTP StatusDescriptionResolution
INSUFFICIENT_PERMISSIONS403API key lacks required scopeRequest a key with appropriate permissions
ORGANIZATION_ACCESS_DENIED403API key cannot access this organizationUse a key associated with the correct org

Example

{
  "success": false,
  "error": {
    "code": "INSUFFICIENT_PERMISSIONS",
    "message": "API key does not have permission to execute workflows",
    "details": {
      "required": ["workflow:execute"],
      "granted": ["workflow:read"]
    }
  }
}

Resource Errors (404)

These errors indicate the requested resource doesn't exist.

CodeHTTP StatusDescriptionResolution
RESOURCE_NOT_FOUND404Generic resource not foundVerify the resource ID is correct
WORKFLOW_NOT_FOUND404Specified workflow doesn't existCheck workflow ID or create the workflow
RUN_NOT_FOUND404Specified workflow run doesn't existVerify the run ID
CONNECTION_NOT_FOUND404Integration connection doesn't existSet up the connection first
ORGANIZATION_NOT_FOUND404Organization doesn't existVerify organization ID

Example

{
  "success": false,
  "error": {
    "code": "WORKFLOW_NOT_FOUND",
    "message": "Workflow not found",
    "details": {
      "workflowId": "wf_abc123"
    }
  }
}

Validation Errors (400/422)

These errors indicate problems with the request data.

CodeHTTP StatusDescriptionResolution
BAD_REQUEST400Generic bad requestReview request format
VALIDATION_ERROR422Request body failed validationCheck details for specific field errors
INVALID_REQUEST_BODY400Request body is malformedEnsure valid JSON format
MISSING_REQUIRED_FIELD400Required field is missingAdd the missing field
INVALID_FIELD_VALUE400Field value is invalidCheck field constraints
WORKFLOW_INACTIVE400Attempted to execute inactive workflowActivate the workflow first
FILE_TOO_LARGE400Uploaded file exceeds size limitReduce file size (max 10MB)
INVALID_FILE_TYPE400File type not supportedUse a supported file format
NO_FILE_PROVIDED400File upload expected but not receivedInclude file in request

Validation Error Example

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed",
    "details": [
      {
        "path": "steps[0].config.prompt",
        "message": "Required field is missing"
      },
      {
        "path": "name",
        "message": "String must contain at least 1 character(s)"
      }
    ]
  }
}

Rate Limiting Errors (429)

CodeHTTP StatusDescriptionResolution
RATE_LIMIT_EXCEEDED429Too many requestsWait and retry after the specified time
RATE_LIMITED429Generic rate limitCheck Retry-After header

Rate Limit Headers

When rate limited, check these response headers:

HeaderDescription
X-RateLimit-LimitMaximum requests allowed per window
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetUnix timestamp when the window resets
Retry-AfterSeconds to wait before retrying

Example

{
  "success": false,
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded. Please try again later.",
    "details": {
      "limit": 100,
      "remaining": 0,
      "resetAt": "2026-01-22T12:00:00Z",
      "retryAfter": 45
    }
  }
}

Server Errors (5xx)

These errors indicate server-side issues.

CodeHTTP StatusDescriptionResolution
INTERNAL_ERROR500Unexpected server errorRetry request; contact support if persistent
DATABASE_ERROR500Database operation failedRetry request; check status page
AI_PROVIDER_ERROR500AI provider returned an errorRetry; may be temporary provider issue
EXTERNAL_SERVICE_ERROR502External service failedCheck integration status
SERVICE_UNAVAILABLE503Service temporarily downWait and retry; check status page
STORAGE_NOT_CONFIGURED503File storage not set upContact support
AI_NOT_CONFIGURED503AI provider not configuredCheck API key configuration
TIMEOUT504Request timed outRetry with smaller payload or simpler request

Example

{
  "success": false,
  "error": {
    "code": "AI_PROVIDER_ERROR",
    "message": "AI provider returned an error",
    "details": {
      "provider": "anthropic",
      "originalError": "Rate limit exceeded"
    }
  }
}

Error Handling Best Practices

1. Always Check success Field

const response = await fetch('/api/v1/workflows', {
  headers: { Authorization: `Bearer ${apiKey}` }
});

const data = await response.json();

if (!data.success) {
  console.error(`Error ${data.error.code}: ${data.error.message}`);
  // Handle error based on code
  return;
}

// Use data.data safely
console.log(data.data);

2. Implement Retry Logic for Transient Errors

async function fetchWithRetry(url: string, options: RequestInit, maxRetries = 3) {
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
    const response = await fetch(url, options);
    const data = await response.json();

    if (data.success) return data;

    // Retry on transient errors
    const retryableCodes = ['RATE_LIMITED', 'SERVICE_UNAVAILABLE', 'TIMEOUT'];
    if (retryableCodes.includes(data.error.code)) {
      const retryAfter = data.error.details?.retryAfter || Math.pow(2, attempt);
      await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
      continue;
    }

    // Don't retry on permanent errors
    throw new Error(data.error.message);
  }

  throw new Error('Max retries exceeded');
}

3. Handle Specific Error Codes

switch (data.error.code) {
  case 'MISSING_API_KEY':
  case 'INVALID_API_KEY':
    // Redirect to API key setup
    break;

  case 'RATE_LIMIT_EXCEEDED':
    // Show rate limit message, implement backoff
    break;

  case 'VALIDATION_ERROR':
    // Show field-level errors to user
    const fieldErrors = data.error.details;
    break;

  case 'WORKFLOW_NOT_FOUND':
    // Resource doesn't exist
    break;

  default:
    // Generic error handling
    break;
}

4. Log Request IDs for Support

Always log the requestId from the meta field when encountering errors:

if (!data.success) {
  console.error(`Error ${data.error.code} (Request ID: ${data.meta?.requestId})`);
  // Include requestId when contacting support
}

SDK Error Handling

Node.js SDK

import { Girard AI, GirardAIError } from '@girardai/sdk';

const client = new Girard AI({ apiKey: 'gai_sk_...' });

try {
  const workflow = await client.workflows.execute('wf_123', { input: {} });
} catch (error) {
  if (error instanceof GirardAIError) {
    console.log('Code:', error.code);
    console.log('Message:', error.message);
    console.log('Request ID:', error.requestId);

    if (error.code === 'RATE_LIMIT_EXCEEDED') {
      // Handle rate limiting
    }
  }
}

Python SDK

from girardai import Girard AI, GirardAIError

client = Girard AI(api_key="gai_sk_...")

try:
    workflow = client.workflows.execute("wf_123", input={})
except GirardAIError as e:
    print(f"Code: {e.code}")
    print(f"Message: {e.message}")
    print(f"Request ID: {e.request_id}")

    if e.code == "RATE_LIMIT_EXCEEDED":
        # Handle rate limiting
        pass

Status Codes Summary

HTTP StatusMeaningCommon Codes
200Success-
400Bad RequestBAD_REQUEST, INVALID_REQUEST_BODY
401UnauthorizedMISSING_API_KEY, INVALID_API_KEY
403ForbiddenINSUFFICIENT_PERMISSIONS
404Not Found*_NOT_FOUND
409ConflictCONFLICT
422Validation ErrorVALIDATION_ERROR
429Rate LimitedRATE_LIMIT_EXCEEDED
500Server ErrorINTERNAL_ERROR, DATABASE_ERROR
502Bad GatewayEXTERNAL_SERVICE_ERROR
503Service UnavailableSERVICE_UNAVAILABLE
504TimeoutTIMEOUT

Support

If you encounter persistent errors:

  1. Check the Status Page for known issues
  2. Include the requestId when contacting support
  3. Email: api-support@girardai.com
  4. Documentation: API Reference
Previous
Webhooks
Next
Creating Custom Agents