Skip to content

Error Reference

Comprehensive guide to error codes, messages, and handling in Orchestre.

Error Categories

MCP Protocol Errors

Standard JSON-RPC 2.0 error codes used by MCP:

CodeConstantDescription
-32700PARSE_ERRORInvalid JSON received
-32600INVALID_REQUESTJSON is valid but request object is invalid
-32601METHOD_NOT_FOUNDRequested method does not exist
-32602INVALID_PARAMSInvalid method parameters
-32603INTERNAL_ERRORInternal server error

Example:

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32602,
    "message": "Invalid params",
    "data": {
      "field": "requirements",
      "issue": "String too short (minimum 10 characters)"
    }
  }
}

Tool-Specific Errors

Initialization Errors

CodeDescriptionResolution
TEMPLATE_NOT_FOUNDSpecified template doesn't existUse valid template name
PROJECT_EXISTSProject directory already existsChoose different name or path
INVALID_PROJECT_NAMEProject name contains invalid charactersUse lowercase letters, numbers, hyphens
PERMISSION_DENIEDCannot create project directoryCheck file permissions

Example:

typescript
{
  error: "Template not found",
  code: "TEMPLATE_NOT_FOUND",
  availableTemplates: ["makerkit-nextjs", "cloudflare-hono", "react-native-expo"],
  suggestion: "Use one of the available templates"
}

Analysis Errors

CodeDescriptionResolution
REQUIREMENTS_TOO_VAGUERequirements lack detailProvide specific features and constraints
ANALYSIS_TIMEOUTAnalysis took too longSimplify requirements or retry
API_KEY_MISSINGGemini API key not configuredSet GEMINI_API_KEY environment variable
RATE_LIMIT_EXCEEDEDToo many API requestsWait before retrying

Example:

typescript
{
  error: "Requirements too vague",
  code: "REQUIREMENTS_TOO_VAGUE",
  suggestion: "Include specific features like 'user authentication', 'payment processing', or 'admin dashboard'",
  example: "Build a SaaS platform with user registration, subscription billing, and team management"
}

Planning Errors

CodeDescriptionResolution
INVALID_ANALYSISAnalysis data is malformedRe-run project analysis
CIRCULAR_DEPENDENCYTasks have circular dependenciesReview task dependencies
RESOURCE_CONFLICTParallel tasks conflictAdjust parallelization settings
PLAN_GENERATION_FAILEDCould not generate valid planCheck analysis results

Review Errors

CodeDescriptionResolution
NO_FILES_PROVIDEDNo files to reviewProvide at least one file
FILE_NOT_FOUNDSpecified file doesn't existCheck file paths
REVIEW_CONSENSUS_FAILEDModels strongly disagreeManual review recommended
MODEL_UNAVAILABLEReview model not accessibleCheck API keys and model availability

Research Errors

CodeDescriptionResolution
TOPIC_TOO_BROADResearch topic needs narrowingBe more specific
NO_RESULTS_FOUNDNo relevant information foundTry different keywords
RESEARCH_TIMEOUTResearch took too longSimplify query

Error Response Format

Standard Error Response

typescript
interface ErrorResponse {
  error: string;           // Human-readable error message
  code: string;           // Machine-readable error code
  details?: any;          // Additional error details
  suggestion?: string;    // How to fix the error
  documentation?: string; // Link to relevant docs
  retryable?: boolean;   // Whether retry might succeed
}

Example Error Responses

Validation Error

json
{
  "error": "Validation failed",
  "code": "VALIDATION_ERROR",
  "details": {
    "issues": [
      {
        "path": "requirements",
        "message": "String too short (minimum 10 characters)"
      }
    ]
  },
  "suggestion": "Provide more detailed requirements",
  "documentation": "https://orchestre.ai/docs/api/tool-schemas#analyze_project"
}

API Error

json
{
  "error": "API rate limit exceeded",
  "code": "RATE_LIMIT_EXCEEDED",
  "details": {
    "limit": 60,
    "window": "1 minute",
    "retryAfter": 45
  },
  "suggestion": "Wait 45 seconds before retrying",
  "retryable": true
}

Permission Error

json
{
  "error": "Cannot write to directory",
  "code": "PERMISSION_DENIED",
  "details": {
    "path": "/usr/local/projects",
    "operation": "mkdir"
  },
  "suggestion": "Choose a directory where you have write permissions"
}

Error Handling Best Practices

1. Graceful Degradation

typescript
try {
  const result = await performOperation();
  return result;
} catch (error) {
  // Try fallback approach
  try {
    const fallbackResult = await performFallback();
    return {
      ...fallbackResult,
      warning: "Used fallback method"
    };
  } catch (fallbackError) {
    // Return helpful error
    return {
      error: "Operation failed",
      code: "OPERATION_FAILED",
      suggestion: "Try again with simpler inputs"
    };
  }
}

2. Contextual Error Messages

typescript
function createContextualError(
  operation: string,
  error: Error,
  context: any
): ErrorResponse {
  return {
    error: `Failed to ${operation}`,
    code: error.name,
    details: {
      originalError: error.message,
      context: context
    },
    suggestion: getSuggestionForError(error),
    documentation: getDocumentationLink(operation)
  };
}

3. Retry Logic

typescript
async function withRetry<T>(
  operation: () => Promise<T>,
  maxRetries: number = 3,
  delay: number = 1000
): Promise<T> {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await operation();
    } catch (error) {
      if (i === maxRetries - 1) throw error;
      
      if (isRetryable(error)) {
        await new Promise(resolve => setTimeout(resolve, delay * (i + 1)));
      } else {
        throw error;
      }
    }
  }
}

Common Error Scenarios

Environment Setup

Problem: API keys not configured

bash
Error: GEMINI_API_KEY not found
Code: API_KEY_MISSING

Solution:

bash
export GEMINI_API_KEY="your-api-key"
# Or add to .env file

Template Initialization

Problem: Invalid project name

bash
Error: Project name must be lowercase with hyphens
Code: INVALID_PROJECT_NAME

Solution:

bash
# Bad: "My Project", "my_project", "MyProject"
# Good: "my-project", "awesome-app", "saas-platform"

File Operations

Problem: Cannot read file

bash
Error: ENOENT: no such file or directory
Code: FILE_NOT_FOUND

Solution:

  • Verify file path is correct
  • Check if file exists
  • Ensure proper permissions

API Limits

Problem: Rate limit exceeded

bash
Error: Too many requests
Code: RATE_LIMIT_EXCEEDED

Solution:

  • Implement exponential backoff
  • Reduce parallel operations
  • Cache results when possible

Error Recovery Strategies

1. Automatic Recovery

typescript
// Automatic retry with exponential backoff
async function autoRecover<T>(
  operation: () => Promise<T>
): Promise<T> {
  const delays = [1000, 2000, 4000, 8000];
  
  for (const delay of delays) {
    try {
      return await operation();
    } catch (error) {
      if (!isRecoverable(error)) throw error;
      await sleep(delay);
    }
  }
  
  throw new Error("Max retries exceeded");
}

2. User Intervention

typescript
// Request user input for recovery
function requestUserIntervention(error: ErrorResponse): string {
  return `
Error: ${error.error}

${error.suggestion || "Please check your inputs and try again"}

Need help? See: ${error.documentation || "/troubleshooting"}
`;
}

3. Fallback Options

typescript
// Provide alternative approaches
function suggestAlternatives(error: ErrorResponse): string[] {
  switch (error.code) {
    case "TEMPLATE_NOT_FOUND":
      return [
        "Use a different template",
        "Create a custom template",
        "Start with a minimal setup"
      ];
    case "API_KEY_MISSING":
      return [
        "Set up environment variables",
        "Use local development mode",
        "Check documentation for setup"
      ];
    default:
      return ["Retry the operation", "Check the logs", "Contact support"];
  }
}

Debugging Errors

Enable Debug Mode

bash
# Set debug environment variable
export ORCHESTRE_DEBUG=true

# Or in code
process.env.ORCHESTRE_DEBUG = "true";

Debug Output Format

typescript
if (process.env.ORCHESTRE_DEBUG) {
  console.error("[DEBUG]", {
    timestamp: new Date().toISOString(),
    operation: "analyzeProject",
    input: params,
    error: error.stack,
    context: {
      cwd: process.cwd(),
      env: process.env.NODE_ENV
    }
  });
}

Error Logging

typescript
function logError(error: Error, context: any): void {
  const errorLog = {
    timestamp: new Date().toISOString(),
    error: {
      message: error.message,
      stack: error.stack,
      code: error.code
    },
    context,
    system: {
      platform: process.platform,
      node: process.version,
      memory: process.memoryUsage()
    }
  };
  
  // Write to error log
  fs.appendFileSync(
    ".orchestre/errors.log",
    JSON.stringify(errorLog) + "\n"
  );
}

See Also

Built with ❤️ for the AI Coding community, by Praney Behl