wavetermdev/waveterm · error

HTTP ${response.status}: ${response.statusText}

Error message

HTTP ${response.status}: ${response.statusText}

What it means

_sendRenderRequest POSTs a frontend-update (feUpdate) to the Tsunami render server. Any non-ok HTTP response is converted into this error carrying status and statusText, aborting the render round-trip.

Source

Thrown at tsunami/frontend/src/model/tsunami-model.tsx:444

        if (!force && !this.needsUpdate) {
            return;
        }
        this.hasPendingRequest = true;
        this.needsImmediateUpdate = false;
        try {
            const feUpdate = this.createFeUpdate();
            dlog("fe-update", feUpdate);

            const response = await fetch("/api/render", {
                method: "POST",
                headers: {
                    "Content-Type": "application/json",
                },
                body: JSON.stringify(feUpdate),
            });

            if (!response.ok) {
                throw new Error(`HTTP ${response.status}: ${response.statusText}`);
            }

            // Check if EventSource connection is closed and reconnect if needed
            if (this.serverEventSource && this.serverEventSource.readyState === EventSource.CLOSED) {
                dlog("EventSource connection closed, reconnecting");
                this.setupServerEventSource();
            }

            const backendUpdate: VDomBackendUpdate = await response.json();
            if (backendUpdate !== null) {
                restoreVDomElems(backendUpdate);
                dlog("be-update", backendUpdate);
                this.handleBackendUpdate(backendUpdate);
            }
            dlog("update cycle done");
        } finally {
            this.lastUpdateTs = Date.now();
            this.hasPendingRequest = false;

View on GitHub (pinned to a4447c1563)

Solutions

  1. Log response.status: 400/422 → inspect the feUpdate payload against the server's expected schema; 404 → wrong endpoint/baseUrl; 500 → check server logs; 502/504 → proxy/upstream.
  2. Confirm the Tsunami server is up and its URL matches the model's configured endpoint.
  3. Re-align frontend/backend versions if the feUpdate shape changed.
  4. Retry transient statuses (502/503/504) with backoff; the code already reconnects a closed EventSource, extend that to failed renders.

Example fix

// before
const response = await fetch(url, { method: "POST", body: JSON.stringify(feUpdate) });
if (!response.ok) throw new Error(`HTTP ${response.status}: ${response.statusText}`);
// after
const response = await fetch(url, { method: "POST", body: JSON.stringify(feUpdate) });
if (response.status === 503 || response.status === 504) {
  await sleep(1000); return this._sendRenderRequest(feUpdate); // retry transient
}
if (!response.ok) throw new Error(`Render request failed: HTTP ${response.status}: ${await response.text()}`);
Defensive patterns

Strategy: retry

Validate before calling

const res = await fetch(renderUrl, { method: "HEAD" });
if (!res.ok) throw new Error(`render server not ready at ${renderUrl} (HTTP ${res.status})`);
// only then send render requests

Try / catch

try {
  await this._sendRenderRequest(feUpdate);
} catch (e) {
  if (/^HTTP (502|503|504)/.test(e.message)) {
    await sleep(1000);
    return this._sendRenderRequest(feUpdate); // retry transient upstream errors
  }
  throw e;
}

Prevention

When it happens

Trigger: The POST to the render endpoint returns 4xx/5xx — render server not running or restarted, malformed feUpdate rejected with 400/422, server-side crash (500), or auth/proxy rejection.

Common situations: Tsunami backend down or listening on a different port than the frontend model expects, request body schema drift after an upgrade, long render timing out at a proxy (504).

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/cede9fd98cab6baa. Report an issue: GitHub.