denoland/deno · error

invalid vsock addr

Error message

invalid vsock addr

What it means

The value of OTEL_DENO_VSOCK must be a `cid:port` pair; the code splits on the first colon and rejects values that have none. cid `-1` maps to VMADDR_CID_ANY (u32::MAX); other cids and the port are parsed numerically, with malformed numbers surfacing as separate parse errors via `?`.

Source

Thrown at ext/telemetry/lib.rs:817

      } else if let Ok(addr) = std::env::var("OTEL_DENO_VSOCK") {
        #[cfg(not(any(
          target_os = "android",
          target_os = "linux",
          target_os = "macos"
        )))]
        {
          let _ = addr;
          deno_core::anyhow::bail!("vsock is not supported on this platform")
        }

        #[cfg(any(
          target_os = "android",
          target_os = "linux",
          target_os = "macos"
        ))]
        {
          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);
          Connector::Vsock(addr)
        }
      } else {
        let ca_certs = match std::env::var("OTEL_EXPORTER_OTLP_CERTIFICATE") {
          Ok(path) => vec![sys.fs_read(path)?.into_owned()],
          _ => vec![],
        };

        let keys = match (
          std::env::var("OTEL_EXPORTER_OTLP_CLIENT_KEY"),
          std::env::var("OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE"),
        ) {
          (Ok(key_path), Ok(cert_path)) => {
            let key = sys.fs_read(key_path)?;

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Use the exact `cid:port` form, e.g. `OTEL_DENO_VSOCK=2:4317`
  2. Use `-1` as the cid for VMADDR_CID_ANY: `OTEL_DENO_VSOCK=-1:4317`
  3. Remove any scheme prefix (`vsock://`) or spaces copied from documentation

Example fix

# before — no colon separator
export OTEL_DENO_VSOCK="2 4317"

# after — cid:port form; -1 means VMADDR_CID_ANY
export OTEL_DENO_VSOCK="2:4317"
Defensive patterns

Strategy: validation

Validate before calling

vsock="${OTEL_DENO_VSOCK:-}"
if [ -n "$vsock" ] && ! printf '%s' "$vsock" | grep -Eqx -- '-?[0-9]+:[0-9]+'; then
  echo "OTEL_DENO_VSOCK must be cid:port, got: '$vsock'"; exit 1
fi
deno run --unstable-otel main.ts

Prevention

When it happens

Trigger: Setting OTEL_DENO_VSOCK to a value with no colon: `2 4317`, `vsock://2:4317`, a bare port like `4317`, or a URL-style endpoint copied from OTEL_EXPORTER_OTLP_ENDPOINT.

Common situations: Reusing the URL format of the HTTP endpoint variable for the vsock variable; hand-writing Firecracker/microVM configs and dropping the colon; whitespace typos.

Related errors


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/b1edbfc4e0863135. Report an issue: GitHub.