{"record":{"id":"7af1053a3e6f055a","repo":"koala73/worldmonitor","slug":"method-post-http-postresp-status","errorCode":null,"errorMessage":"${method} POST HTTP ${postResp.status}","messagePattern":"(.+?) POST HTTP (.+?)","errorType":"exception","errorClass":null,"httpStatus":422,"severity":"error","filePath":"api/mcp-proxy.ts","lineNumber":484,"sourceCode":"    this._pending.set(id, deferred);\n    const timer = setTimeout(() => {\n      if (this._pending.has(id)) {\n        this._pending.delete(id);\n        deferred.reject(new Error(`RPC ${method} timed out`));\n      }\n    }, SSE_RPC_TIMEOUT_MS);\n    try {\n      await revalidateBeforeFetch(new URL(this._endpointUrl));\n      const postResp = await fetch(this._endpointUrl, {\n        method: 'POST',\n        headers: { ...this._headers, 'Content-Type': 'application/json' },\n        body: JSON.stringify({ jsonrpc: '2.0', id, method, params }),\n        redirect: 'manual',\n        signal: AbortSignal.timeout(SSE_RPC_TIMEOUT_MS),\n      });\n      if (!postResp.ok) {\n        this._pending.delete(id);\n        throw new Error(`${method} POST HTTP ${postResp.status}`);\n      }\n      return await deferred.promise;\n    } finally {\n      clearTimeout(timer);\n    }\n  }\n\n  async notify(method, params) {\n    await revalidateBeforeFetch(new URL(this._endpointUrl));\n    await fetch(this._endpointUrl, {\n      method: 'POST',\n      headers: { ...this._headers, 'Content-Type': 'application/json' },\n      body: JSON.stringify({ jsonrpc: '2.0', method, params }),\n      redirect: 'manual',\n      signal: AbortSignal.timeout(5_000),\n    }).catch(() => {});\n  }\n","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/koala73/worldmonitor/blob/9361220cc013571781071f0206e4d80fd14b2f7f/api/mcp-proxy.ts#L466-L502","documentation":"Thrown by SseSession.send when the POST of a JSON-RPC message to the server-advertised endpoint URL returned a non-2xx HTTP status. The SSE stream is up and the endpoint URL was re-validated against SSRF rules, but the server rejected the message POST itself (expired session, auth, or upstream error). The pending RPC deferred is rejected with this error and the timeout timer is cleared.","triggerScenarios":"Thrown at api/mcp-proxy.ts:482 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the status in the message: 404 commonly means the session/endpoint expired — reconnect to get a fresh endpoint event","Ensure auth headers are applied to the POST as well as the SSE stream","Retry the whole SSE session (connect + send) for transient 5xx failures"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9361220cc013571781071f0206e4d80fd14b2f7f","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}