{"record":{"id":"5b0f76f5c8b7f495","repo":"denoland/deno","slug":"invalid-socket-address","errorCode":null,"errorMessage":"invalid socket address","messagePattern":"invalid socket address","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ext/cron/socket.rs","lineNumber":407,"sourceCode":"            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\nasync fn register_cron(\n  socket_writer: &mut BufWriter<impl tokio::io::AsyncWrite + Unpin>,\n  spec: &CronSpec,\n) -> Result<(), std::io::Error> {\n  let cron = CronRegistration {\n    name: &spec.name,\n    schedule: &spec.cron_schedule,\n    backoff_schedule: spec.backoff_schedule.as_deref(),\n  };\n\n  let msg = OutboundMessage::Register { crons: &[cron] };\n","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/cron/socket.rs#L389-L425","documentation":"connect_to_socket() in ext/cron/socket.rs accepts exactly three address forms: 'tcp:<addr>', 'unix:<path>' (non-Windows builds), and 'vsock:<cid>:<port>' (linux/android/macos builds). Any other value — unknown scheme, missing scheme, or a scheme compiled out for the platform — falls through to the catch-all arm and returns io::ErrorKind::InvalidInput 'invalid socket address'. The address comes from DENO_UNSTABLE_CRON_SOCK.","triggerScenarios":"DENO_UNSTABLE_CRON_SOCK='localhost:5000' (no tcp: prefix), 'udp:127.0.0.1:53' (unsupported scheme), 'http://sched:5000', '' (empty string), 'tcp' with no colon at all, or 'unix:/tmp/cron.sock' on Windows where the unix arm is not compiled in.","commonSituations":"Assuming the variable takes a plain host:port; forgetting the scheme prefix; attempting a Unix-domain-socket scheduler on a Windows host; copy-pasting a URL instead of a socket address.","solutions":["Prefix the address with a supported scheme: 'tcp:127.0.0.1:5000'","Use 'unix:/path/to/socket' for Unix domain sockets (not available on Windows)","Use 'vsock:cid:port' for AF_VSOCK schedulers on linux/android/macos","Leave DENO_UNSTABLE_CRON_SOCK unset to use the built-in local cron handler"],"exampleFix":"# before\nDENO_UNSTABLE_CRON_SOCK='localhost:5000' deno run app.ts\n# Error: invalid socket address\n\n# after\nDENO_UNSTABLE_CRON_SOCK='tcp:localhost:5000' deno run app.ts","handlingStrategy":"validation","validationCode":"const addr = Deno.env.get('DENO_UNSTABLE_CRON_SOCK')?.trim() ?? '';\nconst okSchemes = /^(tcp:|unix:|vsock:)/;\nif (addr && !okSchemes.test(addr)) {\n  throw new Error(\n    `Unsupported cron socket address '${addr}'; expected tcp:host:port, unix:/path, or vsock:cid:port`,\n  );\n}\nif (addr.startsWith('unix:') && Deno.build.os === 'windows') {\n  throw new Error('unix: cron sockets are not supported on Windows');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include a scheme prefix in DENO_UNSTABLE_CRON_SOCK","Check scheme availability per platform (unix: is not compiled on Windows)","Leave the variable unset unless an external cron scheduler is actually in use"],"tags":["cron","socket-address","environment-variable","unsupported-scheme","invalid-input"],"backgroundTag":"unsupported-url-scheme","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"}