{"record":{"id":"66cf2a5b9638fda7","repo":"BloopAI/vibe-kanban","slug":"webrtc-offer-failed-response-status-response","errorCode":null,"errorMessage":"WebRTC offer failed: ${response.status} ${response.statusText}","messagePattern":"WebRTC offer failed: (.+?) (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/remote-web/src/shared/lib/webrtc/connection.ts","lineNumber":113,"sourceCode":"    });\n\n    const offer = await pc.createOffer();\n    await pc.setLocalDescription(offer);\n    await gatheringDone;\n\n    const sessionId = crypto.randomUUID();\n    const offerSdp = pc.localDescription!.sdp;\n\n    const sdpOffer: SdpOffer = { sdp: offerSdp, session_id: sessionId };\n    const response = await requestRelayHostApi(hostId, \"/api/webrtc/offer\", {\n      method: \"POST\",\n      headers: { \"Content-Type\": \"application/json\" },\n      body: JSON.stringify(sdpOffer),\n    });\n\n    if (!response.ok) {\n      pc.close();\n      throw new Error(\n        `WebRTC offer failed: ${response.status} ${response.statusText}`,\n      );\n    }\n\n    const answerResponse: ApiResponse<SdpAnswer> = await response.json();\n    if (!answerResponse.success || !answerResponse.data) {\n      pc.close();\n      throw new Error(\n        answerResponse.message ?? \"WebRTC offer response missing SDP answer\",\n      );\n    }\n\n    await pc.setRemoteDescription({\n      type: \"answer\",\n      sdp: answerResponse.data.sdp,\n    });\n\n    const conn = new WebRtcConnection(pc, dc, callbacks);","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/packages/remote-web/src/shared/lib/webrtc/connection.ts#L95-L131","documentation":"During WebRTC connection setup, connect() POSTs the SDP offer to the signaling endpoint. If the HTTP response is not ok (non-2xx), the peer connection is closed and this error is thrown with the status code and status text so the caller knows the signaling exchange failed before any answer SDP arrived.","triggerScenarios":"connect() -> fetch(signalingUrl, { body: sdpOffer }); server returns 4xx/5xx (bad request, 401/403 auth failure, 404 wrong path, 500 server error, 502 proxy failure); !response.ok branch closes pc and throws.","commonSituations":"Signaling server URL misconfigured or wrong port; relay/host not reachable so the server rejects the offer; auth token missing/expired on the signaling request; reverse proxy returning 502 while the host service restarts.","solutions":["Log response.status and read the message from the signaling server response body to identify the cause.","Verify the signaling endpoint URL and that the remote host is online and paired.","Ensure valid auth credentials are attached to the request.","Retry with backoff if the status is 5xx (transient server/proxy issue); check server logs."],"exampleFix":"// before\nif (!response.ok) { pc.close(); throw new Error(`WebRTC offer failed: ...`); }\n// after\nif (!response.ok) {\n  pc.close();\n  const body = await response.text().catch(() => '');\n  if (response.status >= 500) return retryWithBackoff(() => connect(...));\n  throw new Error(`WebRTC offer failed: ${response.status} ${body || response.statusText}`);\n}","handlingStrategy":"retry","validationCode":"async function isSignalingReachable(url: string): Promise<boolean> {\n  try { return (await fetch(url, { method: 'OPTIONS' })).status < 500; }\n  catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await connect(opts);\n} catch (e) {\n  const m = /WebRTC offer failed: (\\d+)/.exec(e.message);\n  if (m && Number(m[1]) >= 500) await backoff(() => connect(opts), 3);\n  else if (m) showSignalingError(Number(m[1]));\n  else throw e;\n}","preventionTips":["Verify the signaling endpoint URL/port and host connectivity before starting WebRTC.","Attach valid auth to the signaling request and refresh tokens beforehand.","Retry 5xx responses with backoff; fail fast on 4xx with a clear UI message.","Check that any reverse proxy in front of the signaling service allows the request."],"tags":["webrtc","signaling","http","network"],"backgroundTag":"webrtc-signaling-failure","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}