Skip to content
Enterprise Beta

JSON-RPC Security Error Codes

JSON-RPC Security Error Codes 🛑

When FaradAiWire’s Policy Enforcement Point (PEP) intercepts an adversarial payload, policy violation, or rate limit breach, it returns a standard JSON-RPC 2.0 error response with a deterministic negative integer code (pkg/mcp/protocol.go).

{
"jsonrpc": "2.0",
"id": "req-004",
"error": {
"code": -32004,
"message": "Security policy violation: AWS secret key detected in arguments (aws_credentials)",
"data": {
"filter": "dlp",
"verdict": "BLOCKED",
"rule": "aws_credentials"
}
}
}

Gateway Security Error Catalog

CodeConstantMeaningTypical Trigger
-32000ErrGatewayGateway internal error or rate limit burst exceededToken-bucket rate limit exhausted.
-32001ErrPrefillBlockedAssistant prefill injection detectedAgent input contains conversational prefill hijack tokens.
-32002ErrLoopDetectedInfinite reasoning loop detectedThe exact same tool was called ≥ max_repeat times with identical arguments.
-32003mcp.ErrPolicyDeniedPolicy authorization deniedTool is blacklisted in agents/<agent>.yaml (Standardized in ADR-0050).
-32004ErrDLPBlockedSensitive data pattern detectedArgument contains private keys, .env references, or credentials.
-32005ErrHITLRejectedOperator rejected or approval timed outHuman operator declined execution of a destructive tool or failed to confirm within SLA.

Standard JSON-RPC 2.0 Protocol Codes

FaradAiWire also enforces standard JSON-RPC 2.0 specification errors:

CodeMeaningReason
-32700Parse errorInbound payload was not valid JSON.
-32600Invalid RequestJSON-RPC frame missing "jsonrpc": "2.0" or "id".
-32601Method not foundRequested MCP method (e.g. unknown/method) is not implemented.
-32602Invalid paramsArguments fail JSON Schema validation or mandatory fields are missing.
-32603Internal errorUpstream MCP tool crashed or returned malformed output.

When developing autonomous LLM agents or prompt scaffolding, guide the model’s behavior based on error codes:

  • Upon -32004 (DLP Blocked): Prompt the LLM: “Your previous tool call was blocked because it contained credentials. Strip the secret and retry without exposing sensitive data.”
  • Upon -32002 (Loop Detected): Prompt the LLM: “You are repeating the same tool call without progress. Change your approach or ask the user for clarification.”
  • Upon -32005 (HITL Rejected): Prompt the LLM: “The human operator refused authorization for this destructive action. Do not attempt to retry this tool.”