Error Handling

Comprehensive guide to error handling, troubleshooting, and debugging in the MCP Confluence ADF system.

Overview

The MCP Confluence ADF server implements robust error handling across all operations, providing clear error messages, automatic recovery mechanisms, and comprehensive troubleshooting tools.

graph TD
    A[Operation Request] --> B{Validation}
    B -->|Pass| C[Execute Operation]
    B -->|Fail| D[Validation Error]
    C --> E{Success?}
    E -->|Yes| F[Return Result]
    E -->|No| G[Error Handler]
    G --> H[Log Error]
    G --> I[Recovery Attempt]
    I --> J{Recoverable?}
    J -->|Yes| K[Retry Operation]
    J -->|No| L[Return Error]
    
    style D fill:#ffebee
    style G fill:#fff3e0
    style L fill:#ffebee

Error Categories

1. Authentication Errors

OAuth Authentication Failed

Error Code: AUTH_OAUTH_FAILED Description: OAuth authentication process failed Common Causes:

  • Invalid client credentials

  • Expired authorization codes

  • Network connectivity issues

  • Incorrect redirect URI

Example:

Recovery Actions:

  1. Verify client ID and secret in Atlassian Developer Console

  2. Check redirect URI matches exactly

  3. Ensure all required OAuth scopes are granted

  4. Retry OAuth initialization process

Token Expired

Error Code: AUTH_TOKEN_EXPIRED Description: Access token has expired and refresh failed Common Causes:

  • Refresh token expired (90 days inactive)

  • Token revoked by user

  • Refresh token invalid

Recovery Actions:

Insufficient Permissions

Error Code: AUTH_INSUFFICIENT_SCOPE Description: Operation requires permissions not granted to the OAuth app Common Causes:

  • Missing required OAuth scopes

  • User doesn't have Confluence permissions

  • Space-level permission restrictions

Required Scopes by Operation:

2. Network and Connectivity Errors

Connection Timeout

Error Code: NETWORK_TIMEOUT Description: Request to Confluence API timed out Default Timeout: 30 seconds

Recovery Strategy:

Rate Limit Exceeded

Error Code: NETWORK_RATE_LIMITED Description: Too many requests to Confluence API Rate Limits:

  • 10 requests per second per app

  • 10,000 requests per day per app

Automatic Handling:

  • Request queuing and throttling

  • Exponential backoff on rate limit errors

  • Automatic retry after rate limit reset

Network Unreachable

Error Code: NETWORK_UNREACHABLE Description: Cannot connect to Confluence instance Common Causes:

  • Network connectivity issues

  • Incorrect Confluence URL

  • Firewall or proxy restrictions

3. Content and Data Errors

Page Not Found

Error Code: CONTENT_PAGE_NOT_FOUND Description: Requested Confluence page doesn't exist or isn't accessible

Example:

Invalid ADF Format

Error Code: CONTENT_INVALID_ADF Description: Generated or provided ADF document is invalid

Validation Errors:

  • Schema validation failures

  • Invalid node relationships

  • Missing required attributes

  • Malformed content structure

Recovery Process:

  1. Validate ADF against Confluence schema

  2. Identify specific validation errors

  3. Attempt automatic correction

  4. Provide manual editing suggestions if auto-correction fails

Content Too Large

Error Code: CONTENT_SIZE_EXCEEDED Description: Content exceeds Confluence size limits Limits:

  • Page content: 2MB

  • Attachment: 10MB (varies by plan)

Automatic Handling:

  • Content size estimation before upload

  • Chunking for large content

  • Warning at 80% of size limit

4. Template Processing Errors

Template Not Found

Error Code: TEMPLATE_NOT_FOUND Description: Requested template doesn't exist in templates directory

Recovery Actions:

YAML Parse Error

Error Code: TEMPLATE_YAML_INVALID Description: Template YAML syntax is invalid

Common Issues:

  • Indentation errors

  • Missing quotes around strings with special characters

  • Invalid YAML syntax

Example Error:

Validation Tools:

Missing User Context

Error Code: TEMPLATE_MISSING_CONTEXT Description: Required user context variables not provided

Example:

5. System and Server Errors

MCP Protocol Error

Error Code: MCP_PROTOCOL_ERROR Description: Error in Model Context Protocol communication

Common Causes:

  • Invalid MCP message format

  • Protocol version mismatch

  • Connection interruption

Server Configuration Error

Error Code: SERVER_CONFIG_ERROR Description: Server configuration is invalid or incomplete

Configuration Validation:

Error Response Format

Standard Error Structure

All errors follow a consistent format:

Error Severity Levels

Logging and Diagnostics

Log Levels

Enable Debug Logging

Log Output Examples

Info Level:

Debug Level:

Error Level:

Diagnostic Tools

Health Check

Health Check Response:

Connection Test

Template Validation

Troubleshooting Workflows

Authentication Issues

Step-by-Step Troubleshooting:

  1. Check Authentication Status:

  2. Clear and Reset (if needed):

  3. Verify Permissions:

    • Check OAuth scopes in Developer Console

    • Verify user permissions in Confluence

    • Test with minimal required scopes

Content Operation Issues

Common Solutions:

  1. Page Access Issues:

    • Verify page ID is correct

    • Check space permissions

    • Confirm page hasn't been deleted

  2. Content Format Issues:

    • Validate Markdown syntax

    • Test ADF conversion

    • Check for unsupported elements

  3. Size and Limit Issues:

    • Check content size limits

    • Split large content into sections

    • Optimize images and attachments

Template Processing Issues

Recovery Strategies

Automatic Recovery

Retry Logic

Circuit Breaker Pattern

Manual Recovery

Data Recovery

Content Recovery

Error Prevention

Input Validation

Preemptive Validation

Content Sanitization

Rate Limiting

Request Throttling

Monitoring and Alerts

Error Tracking

Health Monitoring

Best Practices

Error Message Design

Clear and Actionable

Progressive Disclosure

Graceful Degradation

Partial Success Handling

Fallback Mechanisms

Testing Error Scenarios

Unit Tests

Integration Tests

Next Steps

Last updated