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 Code | Typical HTTP / Layer | Trigger Condition | Client Action |
|---|---|---|---|
| UNAUTHORIZED | 401 / Tool | Missing, expired, unknown, or revoked Bearer token | Refresh OAuth token or re-authenticate via /oauth/authorize or /account |
| FORBIDDEN | 403 / Tool | Missing scope, guild outside allowedGuildIds, BotBlacklist entry, or insufficient live Discord/DB RBAC | Verify scopes and server permissions; do not retry unchanged |
| TIER_UPGRADE_REQUIRED | Tool | Requested module, action, or quota cap requires Pro or Enterprise plan | Direct server owner to https://taicket.xyz/dashboard/{guildId}/premium |
| VALIDATION_ERROR | Tool (-32602) | Invalid snowflake, unsafe ReDoS regex, unsafe role delegation, or character limit overflow | Inspect field message and correct arguments using get_server_topology |
| CROSS_GUILD_RESOURCE | Tool | Supplied channel, category, or role ID belongs to a different Discord server | Fetch valid IDs for the target guild via get_server_topology |
| CONFIRMATION_REQUIRED | Tool | Write or apply call missing explicit confirmed: true or valid preview confirmationToken | Run preview mode first and obtain confirmation |
| HUMAN_APPROVAL_REQUIRED | Tool | Destructive deletion or structural Discord auto-setup awaits human browser sign-off | Present approvalUrl (/oauth/approve-action?id=<planId>) to the user |
| DASHBOARD_ONLY | Tool | Action 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_FOUND | Tool | Target guild, panel, rule, custom command, or preview planId does not exist or expired | Re-query state or regenerate preview plan |
| RATE_LIMITED | 429 / Tool | Per-user sliding window exceeded (60 read, 20 write, 10 deploy, 5 destructive per min) | Back off according to retryAfterSeconds |
| DISCORD_API_ERROR | Tool | Upstream Discord REST API failure (missing bot permission 50013, rate limit, or outage) | Check bot role hierarchy and Discord permissions via get_server_topology |
| INTERNAL_ERROR | 500 / Tool | Unexpected internal failure after full secret and stack redaction | Retry 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"
}
}
}
}