MCP Reference

Error Handling

Transport-level JSON-RPC errors and zero-leakage application error codes normalized through sanitizeMcpError.

Two-Layer Error Model

Taicket MCP separates transport/protocol errors from domain/tool errors so AI hosts always know whether to re-authenticate, fix malformed arguments, guide a human to approve an action, or stop retrying.

  • Layer 1 - HTTP & JSON-RPC Protocol Errors:: Returned for unauthenticated requests (HTTP 401), malformed JSON (-32700), invalid JSON-RPC structure (-32600), unknown methods (-32601), schema parameter failures (-32602), or unhandled server faults (-32603).
  • Layer 2 - Tool Application Errors (sanitizeMcpError):: Returned inside CallToolResult with isError: true and a deterministic machine-readable code alongside plain, human-readable server-owner guidance. Raw stack traces, MongoDB connection URIs, collection names, internal paths, secrets, and hardcoded internal guild IDs are strictly stripped.

Canonical sanitizeMcpError Codes

Error CodeTypical HTTP / LayerTrigger ConditionClient Action
UNAUTHORIZED401 / ToolMissing, expired, unknown, or revoked Bearer tokenRefresh OAuth token or re-authenticate via /oauth/authorize or /account
FORBIDDEN403 / ToolMissing scope, guild outside allowedGuildIds, BotBlacklist entry, or insufficient live Discord/DB RBACVerify scopes and server permissions; do not retry unchanged
TIER_UPGRADE_REQUIREDToolRequested module, action, or quota cap requires Pro or Enterprise planDirect server owner to https://taicket.xyz/dashboard/{guildId}/premium
VALIDATION_ERRORTool (-32602)Invalid snowflake, unsafe ReDoS regex, unsafe role delegation, or character limit overflowInspect field message and correct arguments using get_server_topology
CROSS_GUILD_RESOURCEToolSupplied channel, category, or role ID belongs to a different Discord serverFetch valid IDs for the target guild via get_server_topology
CONFIRMATION_REQUIREDToolWrite or apply call missing explicit confirmed: true or valid preview confirmationTokenRun preview mode first and obtain confirmation
HUMAN_APPROVAL_REQUIREDToolDestructive deletion or structural Discord auto-setup awaits human browser sign-offPresent approvalUrl (/oauth/approve-action?id=<planId>) to the user
DASHBOARD_ONLYToolAction is restricted to taicket.xyz (Temp Admin delegation, Anti-Nuke Trusted Staff, Lockdown, Backup Restore, live member actions, billing)Direct the user to complete the action in the Taicket web dashboard
NOT_FOUNDToolTarget guild, panel, rule, custom command, or preview planId does not exist or expiredRe-query state or regenerate preview plan
RATE_LIMITED429 / ToolPer-user sliding window exceeded (60 read, 20 write, 10 deploy, 5 destructive per min)Back off according to retryAfterSeconds
DISCORD_API_ERRORToolUpstream Discord REST API failure (missing bot permission 50013, rate limit, or outage)Check bot role hierarchy and Discord permissions via get_server_topology
INTERNAL_ERROR500 / ToolUnexpected internal failure after full secret and stack redactionRetry idempotent reads/writes with backoff; contact support if persistent

Sanitized Tool Error Examples

TIER_UPGRADE_REQUIRED responsejson
{
  "jsonrpc": "2.0",
  "id": 40,
  "result": {
    "isError": true,
    "content": [
      {
        "type": "text",
        "text": "{\"ok\":false,\"error\":{\"code\":\"TIER_UPGRADE_REQUIRED\",\"message\":\"AI Support requires a Pro or Enterprise plan on this server.\",\"requiredTier\":\"pro\",\"upgradeUrl\":\"https://taicket.xyz/dashboard/1189452019384729600/premium\"}}"
      }
    ],
    "structuredContent": {
      "ok": false,
      "error": {
        "code": "TIER_UPGRADE_REQUIRED",
        "message": "AI Support requires a Pro or Enterprise plan on this server.",
        "requiredTier": "pro",
        "upgradeUrl": "https://taicket.xyz/dashboard/1189452019384729600/premium"
      }
    }
  }
}
DASHBOARD_ONLY responsejson
{
  "jsonrpc": "2.0",
  "id": 41,
  "result": {
    "isError": true,
    "content": [
      {
        "type": "text",
        "text": "{\"ok\":false,\"error\":{\"code\":\"DASHBOARD_ONLY\",\"message\":\"Emergency Lockdown and Anti-Nuke Trusted Staff changes can only be performed directly on the Taicket web dashboard.\",\"dashboardUrl\":\"https://taicket.xyz/dashboard/1189452019384729600/antinuke\"}}"
      }
    ],
    "structuredContent": {
      "ok": false,
      "error": {
        "code": "DASHBOARD_ONLY",
        "message": "Emergency Lockdown and Anti-Nuke Trusted Staff changes can only be performed directly on the Taicket web dashboard.",
        "dashboardUrl": "https://taicket.xyz/dashboard/1189452019384729600/antinuke"
      }
    }
  }
}

Related documentation