{"record":{"id":"5f381ae2e8bec063","repo":"denoland/deno","slug":"invalid-vsock-cid","errorCode":null,"errorMessage":"invalid vsock cid","messagePattern":"invalid vsock cid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ext/cron/socket.rs","lineNumber":388,"sourceCode":"    #[cfg(any(\n      target_os = \"android\",\n      target_os = \"linux\",\n      target_os = \"macos\"\n    ))]\n    Some((\"vsock\", addr)) => {\n      use tokio_vsock::VsockAddr;\n      use tokio_vsock::VsockStream;\n      let (cid, port) = addr.split_once(':').ok_or_else(|| {\n        std::io::Error::new(\n          std::io::ErrorKind::InvalidInput,\n          \"invalid vsock addr\",\n        )\n      })?;\n      let cid = if cid == \"-1\" {\n        u32::MAX\n      } else {\n        cid.parse().map_err(|_| {\n          std::io::Error::new(\n            std::io::ErrorKind::InvalidInput,\n            \"invalid vsock cid\",\n          )\n        })?\n      };\n      let port = port.parse().map_err(|_| {\n        std::io::Error::new(\n          std::io::ErrorKind::InvalidInput,\n          \"invalid vsock port\",\n        )\n      })?;\n      let stream = tokio::time::timeout(\n        std::time::Duration::from_secs(5),\n        VsockStream::connect(VsockAddr::new(cid, port)),\n      )\n      .await??;\n      Ok(SocketStream::Vsock(stream))\n    }","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/cron/socket.rs#L370-L406","documentation":"Deno's cron subsystem can delegate cron scheduling to an external scheduler over a socket, configured via the DENO_UNSTABLE_CRON_SOCK environment variable (ext/cron/handler_impl.rs:19). Addresses take the form scheme:detail; for the 'vsock' scheme the detail must be 'cid:port', where cid is a decimal u32, and the literal '-1' is accepted and mapped to u32::MAX (VMADDR_CID_ANY). This io::ErrorKind::InvalidInput error is returned when the cid segment fails to parse as u32.","triggerScenarios":"Setting DENO_UNSTABLE_CRON_SOCK to a vsock address whose CID part is neither a decimal u32 nor '-1': 'vsock:0x3:5000' (hex), 'vsock:-2:5000' (negative other than -1), 'vsock:3.5:5000' (float), 'vsock::5000' (empty), 'vsock:myhost:5000' (hostname), or a CID above 4294967295. The parse runs in connect_to_socket() when Deno first connects the SocketCronHandler to register a Deno.cron() job.","commonSituations":"Running Deno inside a VM sandbox that syncs cron state over AF_VSOCK (Firecracker/gVisor-style environments); an orchestrator or CI injecting DENO_UNSTABLE_CRON_SOCK with a host:port value that someone merely prefixed with 'vsock:'; trailing whitespace or a newline in the injected variable.","solutions":["Write the address as vsock:CID:PORT with a decimal CID, e.g. DENO_UNSTABLE_CRON_SOCK='vsock:3:5000'","Use the special CID -1 for VMADDR_CID_ANY: 'vsock:-1:5000'","For non-vsock schedulers use 'tcp:host:port' or 'unix:/path/to/sock'","Unset DENO_UNSTABLE_CRON_SOCK to fall back to the local in-process cron handler"],"exampleFix":"# before\nDENO_UNSTABLE_CRON_SOCK='vsock:0x0003:5000' deno run app.ts\n# Error: invalid vsock cid\n\n# after\nDENO_UNSTABLE_CRON_SOCK='vsock:3:5000' deno run app.ts","handlingStrategy":"validation","validationCode":"const addr = Deno.env.get('DENO_UNSTABLE_CRON_SOCK');\nif (addr?.startsWith('vsock:')) {\n  const m = addr.match(/^vsock:(-1|\\d{1,10}):(\\d{1,10})$/);\n  if (!m || Number(m[1]) > 0xFFFFFFFF || Number(m[2]) > 0xFFFFFFFF) {\n    throw new Error(\n      `Invalid vsock cron socket address '${addr}'; expected vsock:CID:PORT with decimal u32 CID and port`,\n    );\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate DENO_UNSTABLE_CRON_SOCK at process startup, before registering any Deno.cron() handler","Remember '-1' is the only non-decimal CID accepted (VMADDR_CID_ANY)","Trim whitespace and newlines from injected environment variables"],"tags":["cron","vsock","socket-address","environment-variable","invalid-input"],"backgroundTag":"invalid-endpoint-address","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}