wavetermdev/waveterm · warning
Invalid VDOM URL format
Error message
Invalid VDOM URL format
What it means
handleVDom in pkg/web/webvdomproto.go:24 rejects URLs that do not contain at least one path segment after the /vdom/ prefix. In practice strings.Split never returns fewer than 1 element, so this guard fires only for malformed routing setups where the request reaches the handler without a usable path. It returns HTTP 400.
Source
Thrown at pkg/web/webvdomproto.go:24
import (
"fmt"
"io"
"log"
"net/http"
"strings"
"github.com/wavetermdev/waveterm/pkg/wshrpc"
"github.com/wavetermdev/waveterm/pkg/wshrpc/wshclient"
"github.com/wavetermdev/waveterm/pkg/wshrpc/wshserver"
"github.com/wavetermdev/waveterm/pkg/wshutil"
)
// Add the new handler function
func handleVDom(w http.ResponseWriter, r *http.Request) {
// Extract UUID and path from URL
pathParts := strings.Split(strings.TrimPrefix(r.URL.Path, "/vdom/"), "/")
if len(pathParts) < 1 {
http.Error(w, "Invalid VDOM URL format", http.StatusBadRequest)
return
}
uuid := pathParts[0]
// Simple UUID validation
if len(uuid) != 36 {
http.Error(w, "Invalid UUID format", http.StatusBadRequest)
return
}
// Reconstruct the remaining path
path := "/" + strings.Join(pathParts[1:], "/")
if r.URL.RawQuery != "" {
path += "?" + r.URL.RawQuery
}
// Read request body if present
var body []byteView on GitHub (pinned to a4447c1563)
Solutions
- Check the request URL that reached the server; it must look like /vdom/<36-char-uuid>/<resource-path>.
- Fix the reverse proxy or router config so the /vdom/ prefix and the UUID survive the rewrite.
- Correct the client-side fetch/URL construction to include the UUID path segment.
- Verify the handler registration in the web server routing table points at the right prefix.
Example fix
// before (client)
fetch("/vdom/")
// after
fetch(`/vdom/${blockId}/render`) // blockId is a 36-char UUID Defensive patterns
Strategy: validation
Validate before calling
function validateVdomUrl(blockId, resourcePath) {
if (!blockId) throw new Error("vdom block id required");
return `/vdom/${blockId}/${resourcePath.replace(/^\//, "")}`;
} Try / catch
const resp = await fetch(url);
if (resp.status === 400) {
const msg = await resp.text();
throw new Error(`vdom request rejected: ${msg}`);
} Prevention
- Always include the 36-char UUID as the first segment after /vdom/.
- Audit reverse-proxy rewrite rules so the /vdom/ prefix and UUID are preserved.
- Log the final request URL in debug mode before sending.
When it happens
Trigger: A request hits the /vdom/ route whose URL path, after trimming the prefix, yields no segments — e.g. a proxy or router rewrites the path away, or a misconfigured reverse proxy forwards an empty path to the vdom endpoint.
Common situations: Reverse-proxy strip-prefix rules (nginx 'proxy_pass' with trailing slash) consuming the UUID segment, a webserver route registered with a non-capturing pattern, or manually constructed fetch() calls to /vdom/ with no UUID.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- wcloud endpoint not set
- wcloud ping endpoint not set
- dropping text/plain file with URL (must be fetched and conve
- failed to copy from file: %v
- failed to copy from reader: %v
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/4077e7356c52aca7.
Report an issue: GitHub.