denoland/deno · error · AnyError

invalid vsock addr

Error message

invalid vsock addr

What it means

On supported platforms, Deno parses `OTEL_DENO_VSOCK` as `<cid>:<port>`: the string must split on a colon, cid must be a u32 or the literal `-1` (mapped to u32::MAX / VMADDR_CID_ANY), and port a u32. A value with no colon bails with this message; a present-but-unparsable number propagates the integer parse error instead.

Solutions

  1. Set the full `cid:port` form: `export OTEL_DENO_VSOCK=3:4317`.
  2. Use `-1` as cid to mean VMADDR_CID_ANY: `OTEL_DENO_VSOCK=-1:4317`.
  3. Check for a missing colon, stray spaces, quotes, or a URI prefix in the value.
  4. Remove the variable entirely if you meant HTTP OTLP export.

Example fix

# before
export OTEL_DENO_VSOCK=4317     # port only, no cid -> invalid vsock addr
deno run --otel app.ts

# after: <cid>:<port>; cid -1 means VMADDR_CID_ANY
export OTEL_DENO_VSOCK=3:4317
deno run --otel app.ts
Defensive patterns

Strategy: validation

Validate before calling

# validate OTEL_DENO_VSOCK shape before launching
case "${OTEL_DENO_VSOCK:-}" in
  "") : ;;
  *:*) echo "$OTEL_DENO_VSOCK" | grep -qE '^(-1|[0-9]+):[0-9]+$' || echo "bad OTEL_DENO_VSOCK (need cid:port)" ;;
  *) echo "OTEL_DENO_VSOCK must be <cid>:<port>, e.g. 3:4317" ;;
esac

Prevention

When it happens

Trigger: Setting `OTEL_DENO_VSOCK` to a colon-less value: `OTEL_DENO_VSOCK=4317` (port only), an empty value (`export OTEL_DENO_VSOCK=` from templated env), or a `vsock://3:4317` URI prefix (which fails cid parsing rather than this exact message).

Common situations: Copy-paste typos in .env files; assuming a default cid and setting only the port; confusing vsock cid:port with TCP host:port; empty-string env vars from CI templates.

Related errors


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

Appendix: 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 9ad36f7a2c)