{"record":{"id":"65ffffffaec83206","repo":"denoland/deno","slug":"invalid-vsock-port","errorCode":null,"errorMessage":"invalid vsock port","messagePattern":"invalid vsock port","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ext/cron/socket.rs","lineNumber":395,"sourceCode":"      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    }\n    _ => Err(std::io::Error::new(\n      std::io::ErrorKind::InvalidInput,\n      \"invalid socket address\",\n    )),\n  }\n}\n","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/cron/socket.rs#L377-L413","documentation":"For a vsock cron socket address (DENO_UNSTABLE_CRON_SOCK='vsock:cid:port'), the port segment is parsed into the u32 that tokio_vsock's VsockAddr::new expects. Any port that does not parse as u32 returns io::ErrorKind::InvalidInput 'invalid vsock port'. Note this is a vsock service port, not an IP port, so values above 65535 are legal up to u32::MAX.","triggerScenarios":"DENO_UNSTABLE_CRON_SOCK='vsock:3:abc' (non-numeric), 'vsock:3:5000.5' (float), 'vsock:3:' (empty port after the second colon), a port above 4294967295, or trailing whitespace/newline in the env var value ('vsock:3:5000 ' fails the parse).","commonSituations":"VM sandbox environments syncing cron over AF_VSOCK; operators assuming TCP port limits and writing hex/octal; CI secrets injecting the address with a trailing newline.","solutions":["Use a plain decimal port: DENO_UNSTABLE_CRON_SOCK='vsock:3:5000'","Strip whitespace/newlines from the variable before launching Deno","Double-check copy-pasted addresses for a missing or doubled port segment"],"exampleFix":"# before\nDENO_UNSTABLE_CRON_SOCK='vsock:3:0x1388' deno run app.ts\n# Error: invalid vsock port\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')?.trim() ?? '';\nif (addr.startsWith('vsock:')) {\n  const port = addr.split(':')[2];\n  if (!/^\\d{1,10}$/.test(port) || Number(port) > 0xFFFFFFFF) {\n    throw new Error(`Invalid vsock port in '${addr}'; expected decimal u32`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use decimal vsock service ports (u32); do not assume the TCP 16-bit limit","Trim the env var value before use","Lint CI configuration that sets DENO_UNSTABLE_CRON_SOCK against the vsock:cid:port shape"],"tags":["cron","vsock","port","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"}