BloopAI/vibe-kanban · error · Error

WebRTC offer failed: ${response.status} ${response.statusTex

Error message

WebRTC offer failed: ${response.status} ${response.statusText}

What it means

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.

Source

Thrown at packages/remote-web/src/shared/lib/webrtc/connection.ts:113

    });

    const offer = await pc.createOffer();
    await pc.setLocalDescription(offer);
    await gatheringDone;

    const sessionId = crypto.randomUUID();
    const offerSdp = pc.localDescription!.sdp;

    const sdpOffer: SdpOffer = { sdp: offerSdp, session_id: sessionId };
    const response = await requestRelayHostApi(hostId, "/api/webrtc/offer", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify(sdpOffer),
    });

    if (!response.ok) {
      pc.close();
      throw new Error(
        `WebRTC offer failed: ${response.status} ${response.statusText}`,
      );
    }

    const answerResponse: ApiResponse<SdpAnswer> = await response.json();
    if (!answerResponse.success || !answerResponse.data) {
      pc.close();
      throw new Error(
        answerResponse.message ?? "WebRTC offer response missing SDP answer",
      );
    }

    await pc.setRemoteDescription({
      type: "answer",
      sdp: answerResponse.data.sdp,
    });

    const conn = new WebRtcConnection(pc, dc, callbacks);

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Log response.status and read the message from the signaling server response body to identify the cause.
  2. Verify the signaling endpoint URL and that the remote host is online and paired.
  3. Ensure valid auth credentials are attached to the request.
  4. Retry with backoff if the status is 5xx (transient server/proxy issue); check server logs.

Example fix

// before
if (!response.ok) { pc.close(); throw new Error(`WebRTC offer failed: ...`); }
// after
if (!response.ok) {
  pc.close();
  const body = await response.text().catch(() => '');
  if (response.status >= 500) return retryWithBackoff(() => connect(...));
  throw new Error(`WebRTC offer failed: ${response.status} ${body || response.statusText}`);
}
Defensive patterns

Strategy: retry

Validate before calling

async function isSignalingReachable(url: string): Promise<boolean> {
  try { return (await fetch(url, { method: 'OPTIONS' })).status < 500; }
  catch { return false; }
}

Try / catch

try {
  await connect(opts);
} catch (e) {
  const m = /WebRTC offer failed: (\d+)/.exec(e.message);
  if (m && Number(m[1]) >= 500) await backoff(() => connect(opts), 3);
  else if (m) showSignalingError(Number(m[1]));
  else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29). Data as JSON: /api/errors/66cf2a5b9638fda7. Report an issue: GitHub.