different-ai/openwork · error · SafeProbeFailure

unsupported_protocol_version

unsupported_protocol_version

Error message

unsupported_protocol_version

What it means

requireSupportedProtocolVersion throws SafeProbeFailure("unsupported_protocol_version") when the initialize result's protocolVersion is a well-formed string but does not exactly equal MCP_PROTOCOL_VERSION. The probe pins one protocol version and refuses endpoints negotiating a different one.

Source

Thrown at apps/server/src/agent-context-cloud-probe.ts:542

  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) {
    throw new SafeProbeFailure("invalid_catalog");
  }
  const seen = new Set<string>();
  for (const tool of rpcResult.tools) {
    if (!isRecord(tool) || typeof tool.name !== "string" || tool.name.length > MAX_TOOL_ID_LENGTH || !TOOL_ID.test(tool.name)) {
      throw new SafeProbeFailure("invalid_catalog");
    }
    if (seen.has(tool.name)) throw new SafeProbeFailure("invalid_catalog");
    seen.add(tool.name);
  }
  // Additional provider tools are forward-compatible and allowed, but never

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Upgrade or downgrade the MCP server so its protocolVersion matches the version pinned by this client build
  2. Update the client's MCP_PROTOCOL_VERSION constant to the version the server speaks (via a coordinated release)
  3. Check release notes of both sides for a protocol version bump
  4. Test with a reference MCP server to confirm which version it negotiates

Example fix

// before (server)
protocolVersion: "2025-03-26"
// after (match client constant)
protocolVersion: MCP_PROTOCOL_VERSION // e.g. "2024-11-05"
Defensive patterns

Strategy: fallback

Validate before calling

const version = initResult.protocolVersion;
if (typeof version === "string" && version !== SUPPORTED_VERSIONS) {
  console.warn(`server speaks MCP ${version}; client pins ${SUPPORTED_VERSIONS} — align versions before probing`);
}

Type guard

function isSupportedProtocolVersion(v: unknown): v is string {
  return typeof v === "string" && v === MCP_PROTOCOL_VERSION;
}

Try / catch

try {
  requireSupportedProtocolVersion(initResult);
} catch (e) {
  if (e instanceof SafeProbeFailure && e.code === "unsupported_protocol_version") {
    // surface a clear upgrade instruction; optionally retry against a version-matched endpoint
  } else throw e;
}

Prevention

When it happens

Trigger: Server returns any valid string protocolVersion other than the pinned MCP_PROTOCOL_VERSION constant (e.g. older '2024-10-07' or newer date-versioned releases).

Common situations: Client and server upgraded at different times so MCP protocol versions drifted; server negotiates versions per spec's date-based scheme while the probe expects one fixed value; custom MCP server fork with its own version string.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/3e8ee2737da30919. Report an issue: GitHub.