{"record":{"id":"103f29873e188d08","repo":"different-ai/openwork","slug":"mcp-initialized","errorCode":"MCP_INITIALIZED","errorMessage":"Initialized notification returned HTTP ${initializedResponse.status}","messagePattern":"Initialized notification returned HTTP (.+?)","errorType":"exception","errorClass":"ProbeFailure","httpStatus":null,"severity":"error","filePath":"packages/enterprise-mcp-mock-server/src/testing/probe.ts","lineNumber":789,"sourceCode":"    recordPassed(phases, \"MCP_INITIALIZE\", startedAt, \"MCP version, capabilities, and session negotiated\")\n\n    const sessionHeaders = {\n      ...rpcHeaders,\n      \"mcp-session-id\": sessionId,\n      \"mcp-protocol-version\": initialize.protocolVersion,\n    }\n    startedAt = Date.now()\n    const initializedResponse = await fetchStep(mcpUrl, {\n      method: \"POST\",\n      headers: sessionHeaders,\n      body: JSON.stringify({ jsonrpc: \"2.0\", method: \"notifications/initialized\" }),\n    }, \"MCP_INITIALIZED\", overallDeadline)\n    await discardResponseBody(initializedResponse, \"MCP_INITIALIZED\", \"mcp_lifecycle\")\n    if (initializedResponse.status === 404) {\n      throw new ProbeFailure(\"CONTINUITY_SESSION\", \"mcp_session_expired\", \"MCP session expired after initialize\")\n    }\n    if (initializedResponse.status !== 202) {\n      throw new ProbeFailure(\"MCP_INITIALIZED\", \"mcp_lifecycle\", `Initialized notification returned HTTP ${initializedResponse.status}`)\n    }\n    recordPassed(phases, \"MCP_INITIALIZED\", startedAt, \"Initialized notification received HTTP 202\")\n\n    startedAt = Date.now()\n    const toolNames = new Set<string>()\n    const discoveredTools: MockTool[] = []\n    const cursors = new Set<string>()\n    let cursor: string | undefined\n    let catalogComplete = false\n    for (let page = 0; page < 25; page += 1) {\n      if (cursor) {\n        if (cursors.has(cursor)) throw new ProbeFailure(\"MCP_TOOL_DISCOVERY\", \"mcp_pagination_loop\", \"Tool catalog repeated a cursor\")\n        cursors.add(cursor)\n      }\n      const listRawResponse = await fetchStep(mcpUrl, {\n          method: \"POST\",\n          headers: sessionHeaders,\n          body: JSON.stringify({ jsonrpc: \"2.0\", id: 10 + page, method: \"tools/list\", params: cursor ? { cursor } : {} }),","sourceCodeStart":771,"sourceCodeEnd":807,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/packages/enterprise-mcp-mock-server/src/testing/probe.ts#L771-L807","documentation":"Thrown when the notifications/initialized request returns any status other than the expected 202 (and not 404, which is classified as session expiry instead). MCP streamable-HTTP servers must acknowledge notifications with 202 Accepted; any other status means the lifecycle step did not complete as required.","triggerScenarios":"The initialized notification POST returns 200, 400, 405, 500, etc. — e.g. the server treats notifications as regular JSON-RPC requests, rejects the body, or errors internally.","commonSituations":"Server implemented against an older HTTP transport that replies 200 to notifications; a gateway that rejects POSTs without an id field (notifications have no id); server bug returning 500 on notification handling; wrong content-type negotiation causing 415.","solutions":["Update the server to return 202 Accepted for JSON-RPC notifications (no id)","Check gateway/proxy rules that may reject id-less POST bodies","Inspect the response body/status server-side for an internal error and fix it","Confirm the server implements the streamable-HTTP transport, not an older one"],"exampleFix":"// before (server)\nhandleJsonRpc(body); res.status(200).json(result)\n// after (server)\nif (!(\"id\" in body)) { handleNotification(body); res.status(202).end() }","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  await probeEnterpriseMcpMockServer(scenario)\n} catch (e) {\n  if (e instanceof ProbeFailure && e.code === \"MCP_INITIALIZED\") {\n    console.error(\"Initialized notification rejected:\", e.message)\n  }\n}","preventionTips":["Return 202 Accepted for JSON-RPC notifications (requests without id)","Test the full initialize → notifications/initialized lifecycle","Check gateways accept id-less POST bodies"],"tags":["mcp","http-status","notifications","lifecycle"],"backgroundTag":"unexpected-http-status","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}