{"record":{"id":"3e8ee2737da30919","repo":"different-ai/openwork","slug":"unsupported-protocol-version","errorCode":"unsupported_protocol_version","errorMessage":"unsupported_protocol_version","messagePattern":"unsupported_protocol_version","errorType":"error_code","errorClass":"SafeProbeFailure","httpStatus":null,"severity":"error","filePath":"apps/server/src/agent-context-cloud-probe.ts","lineNumber":542,"sourceCode":"  return messages[0];\n}\n\nfunction parseJsonRpcResult(payload: unknown, requestId: string): Record<string, unknown> {\n  if (!isRecord(payload) || payload.jsonrpc !== \"2.0\") {\n    throw new SafeProbeFailure(\"invalid_jsonrpc_envelope\");\n  }\n  if (Object.hasOwn(payload, \"error\")) throw new SafeProbeFailure(\"jsonrpc_error\");\n  if (payload.id !== requestId) throw new SafeProbeFailure(\"request_id_mismatch\");\n  if (!isRecord(payload.result)) throw new SafeProbeFailure(\"invalid_jsonrpc_envelope\");\n  return payload.result;\n}\n\nfunction requireSupportedProtocolVersion(initializeResult: Record<string, unknown>): void {\n  const version = initializeResult.protocolVersion;\n  if (typeof version !== \"string\" || version.length === 0 || version.length > MAX_PROTOCOL_HEADER_LENGTH) {\n    throw new SafeProbeFailure(\"invalid_jsonrpc_envelope\");\n  }\n  if (version !== MCP_PROTOCOL_VERSION) throw new SafeProbeFailure(\"unsupported_protocol_version\");\n}\n\nfunction validateCatalog(rpcResult: Record<string, unknown>): { toolIds: string[]; totalToolCount: number } {\n  if (rpcResult.nextCursor !== undefined && rpcResult.nextCursor !== null) {\n    throw new SafeProbeFailure(\"pagination_unsupported\");\n  }\n  if (!Array.isArray(rpcResult.tools) || rpcResult.tools.length > MAX_TOOL_COUNT) {\n    throw new SafeProbeFailure(\"invalid_catalog\");\n  }\n  const seen = new Set<string>();\n  for (const tool of rpcResult.tools) {\n    if (!isRecord(tool) || typeof tool.name !== \"string\" || tool.name.length > MAX_TOOL_ID_LENGTH || !TOOL_ID.test(tool.name)) {\n      throw new SafeProbeFailure(\"invalid_catalog\");\n    }\n    if (seen.has(tool.name)) throw new SafeProbeFailure(\"invalid_catalog\");\n    seen.add(tool.name);\n  }\n  // Additional provider tools are forward-compatible and allowed, but never","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/server/src/agent-context-cloud-probe.ts#L524-L560","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Upgrade or downgrade the MCP server so its protocolVersion matches the version pinned by this client build","Update the client's MCP_PROTOCOL_VERSION constant to the version the server speaks (via a coordinated release)","Check release notes of both sides for a protocol version bump","Test with a reference MCP server to confirm which version it negotiates"],"exampleFix":"// before (server)\nprotocolVersion: \"2025-03-26\"\n// after (match client constant)\nprotocolVersion: MCP_PROTOCOL_VERSION // e.g. \"2024-11-05\"","handlingStrategy":"fallback","validationCode":"const version = initResult.protocolVersion;\nif (typeof version === \"string\" && version !== SUPPORTED_VERSIONS) {\n  console.warn(`server speaks MCP ${version}; client pins ${SUPPORTED_VERSIONS} — align versions before probing`);\n}","typeGuard":"function isSupportedProtocolVersion(v: unknown): v is string {\n  return typeof v === \"string\" && v === MCP_PROTOCOL_VERSION;\n}","tryCatchPattern":"try {\n  requireSupportedProtocolVersion(initResult);\n} catch (e) {\n  if (e instanceof SafeProbeFailure && e.code === \"unsupported_protocol_version\") {\n    // surface a clear upgrade instruction; optionally retry against a version-matched endpoint\n  } else throw e;\n}","preventionTips":["Keep client MCP_PROTOCOL_VERSION and server protocol releases in lockstep; coordinate bumps in the same change window","Watch MCP spec release notes for date-versioned protocol changes","Run a version-negotiation smoke test in CI against a reference server","Pin server versions in deployment config so upgrades are explicit"],"tags":["mcp","protocol-version","version-mismatch"],"backgroundTag":"protocol-version-mismatch","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}