different-ai/openwork · error · SafeProbeFailure
jsonrpc_error
jsonrpc_error
Error message
jsonrpc_error
What it means
parseJsonRpcResult throws SafeProbeFailure("jsonrpc_error") when the response payload contains an 'error' member, meaning the remote MCP server rejected the request with a JSON-RPC error object instead of a result. The probe deliberately collapses the remote error's details into a safe fixed code so provider-controlled strings are never surfaced.
Source
Thrown at apps/server/src/agent-context-cloud-probe.ts:531
}
if (line.startsWith(":")) continue;
const colon = line.indexOf(":");
const field = colon < 0 ? line : line.slice(0, colon);
const rawValue = colon < 0 ? "" : line.slice(colon + 1);
const value = rawValue.startsWith(" ") ? rawValue.slice(1) : rawValue;
if (field === "event") event = value;
if (field === "data") data.push(value);
}
dispatch();
if (messages.length !== 1) throw new SafeProbeFailure("invalid_json");
return messages[0];
}
function parseJsonRpcResult(payload: unknown, requestId: string): Record<string, unknown> {
if (!isRecord(payload) || payload.jsonrpc !== "2.0") {
throw new SafeProbeFailure("invalid_jsonrpc_envelope");
}
if (Object.hasOwn(payload, "error")) throw new SafeProbeFailure("jsonrpc_error");
if (payload.id !== requestId) throw new SafeProbeFailure("request_id_mismatch");
if (!isRecord(payload.result)) throw new SafeProbeFailure("invalid_jsonrpc_envelope");
return payload.result;
}
function requireSupportedProtocolVersion(initializeResult: Record<string, unknown>): void {
const version = initializeResult.protocolVersion;
if (typeof version !== "string" || version.length === 0 || version.length > MAX_PROTOCOL_HEADER_LENGTH) {
throw new SafeProbeFailure("invalid_jsonrpc_envelope");
}
if (version !== MCP_PROTOCOL_VERSION) throw new SafeProbeFailure("unsupported_protocol_version");
}
function validateCatalog(rpcResult: Record<string, unknown>): { toolIds: string[]; totalToolCount: number } {
if (rpcResult.nextCursor !== undefined && rpcResult.nextCursor !== null) {
throw new SafeProbeFailure("pagination_unsupported");
}
if (!Array.isArray(rpcResult.tools) || rpcResult.tools.length > MAX_TOOL_COUNT) {View on GitHub (pinned to 2b7df46e8a)
Solutions
- Check the bearer token/credentials the probe is sending are valid and authorized for this MCP server
- Confirm the server supports the initialize and tools/list methods
- Inspect server-side logs for the JSON-RPC error code it returned
- Ensure the probe's JSON-RPC request bodies match the current MCP spec
Example fix
null
Defensive patterns
Strategy: try-catch
Validate before calling
// No reliable pre-call check: JSON-RPC errors depend on server state (auth, method support). // Pre-validate what you can: send valid credentials and only supported methods.
Type guard
function isJsonRpcError(v: unknown): boolean {
return typeof v === "object" && v !== null && Object.hasOwn(v as Record<string, unknown>, "error");
} Try / catch
try {
const result = parseJsonRpcResult(payload, requestId);
} catch (e) {
if (e instanceof SafeProbeFailure && e.code === "jsonrpc_error") {
// rotate credentials / check method support; inspect server logs for the underlying error code
} else throw e;
} Prevention
- Validate the bearer token's expiry and scopes before each probe run
- Keep the client's JSON-RPC method payloads aligned with the MCP spec version in use
- Monitor server-side JSON-RPC error logs to catch auth/policy failures early
When it happens
Trigger: Server responds with {"jsonrpc":"2.0","id":...,"error":{"code":...,"message":...}} for the initialize or tools/list request.
Common situations: Invalid or expired bearer token rejected at protocol level; server does not support the requested MCP method; server-side rate limiting or policy denial; malformed request built by an outdated client.
Related errors
- invalid_jsonrpc_envelope
- request_id_mismatch
- MCP_INITIALIZE
- MCP_PROVIDER_DECLARED_ERROR
- invalid_mcp_token_payload
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/bda63f06c9d33bcc.
Report an issue: GitHub.