denoland/deno · error
invalid control sock
Error message
invalid control sock
What it means
The control-socket address from DENO_UNSTABLE_CONTROL_SOCK is dispatched on its scheme prefix (unix:<path>, and vsock:<cid>:<port> on Unix-like platforms). Anything else - an unknown scheme, or a value with no colon at all - falls into the catch-all bail "invalid control sock".
Solutions
- Prefix the value with a supported scheme: unix:/path/to.sock or vsock:<cid>:<port> (Unix-like only)
- Unset DENO_UNSTABLE_CONTROL_SOCK if the control channel is not intended
- Check the platform: the vsock branch is compiled only for android/linux/macos
Example fix
# before DENO_UNSTABLE_CONTROL_SOCK=/run/deno.sock # after DENO_UNSTABLE_CONTROL_SOCK=unix:/run/deno.sock
Defensive patterns
Strategy: validation
Validate before calling
// Validate the env var before launching
function validControlSock(v: string): boolean {
const schemes = Deno.build.os === "windows" ? ["unix"] : ["unix", "vsock"];
const scheme = v.split(":")[0];
return v.includes(":") && schemes.includes(scheme);
}
if (!validControlSock(addr)) {
throw new Error(`invalid control sock "${addr}" - expected unix:<path> or vsock:<cid>:<port>`);
} Type guard
const isControlSock = (v: string): boolean => /^(unix:|vsock:-1|vsock:\d+:\d+)/.test(v);
Prevention
- Always set a scheme prefix on DENO_UNSTABLE_CONTROL_SOCK
- Check platform support (vsock is Unix-like only) before choosing the scheme
- Unset the variable in environments that do not supervise Deno over a control channel
When it happens
Trigger: DENO_UNSTABLE_CONTROL_SOCK set to a scheme this Deno build does not support (e.g. vsock: on Windows), a bare path without a scheme prefix, or a typo'd scheme.
Common situations: Supervisor or IDE integrations passing an unexpected address format; cross-platform scripts using vsock while running on Windows; stale env vars inherited from another tool.
Related errors
- invalid vsock addr
- Failure from control sock
- APPDATA not set
- Can't convert url (" ") to filename.
- Can't convert url (" ") to filename.
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/4c23154f65bd1d1e.
Report an issue: GitHub.
Appendix: source
Thrown at cli/lib.rs:1268
#[cfg(any(
target_os = "android",
target_os = "linux",
target_os = "macos"
))]
Some(("vsock", addr)) => {
let Some((cid, port)) = addr.split_once(':') else {
deno_core::anyhow::bail!("invalid vsock addr");
};
let cid = if cid == "-1" { u32::MAX } else { cid.parse()? };
let port = port.parse()?;
let addr = VsockAddr::new(cid, port);
let listener = VsockListener::bind(addr)?;
let (stream, _) = listener.accept().await?;
let (rx, tx) = stream.into_split();
(Box::new(rx), Box::new(tx))
}
_ => {
deno_core::anyhow::bail!("invalid control sock");
}
};
let mut buf = Vec::with_capacity(1024);
BufReader::new(rx).read_until(b'\n', &mut buf).await?;
tokio::spawn(async move {
deno_runtime::deno_http::SERVE_NOTIFIER.notified().await;
#[derive(deno_core::serde::Serialize)]
enum Event {
Serving {
#[serde(skip_serializing_if = "Option::is_none")]
kind: Option<&'static str>,
},
}
let mut buf = deno_core::serde_json::to_vec(&Event::Serving {View on GitHub (pinned to 9ad36f7a2c)