{"record":{"id":"fd3db2a14b64d5c2","repo":"denoland/deno","slug":"invalid-value-v-for-flag-host-and-port","errorCode":null,"errorMessage":"invalid value '{v}' for '{flag}=<HOST_AND_PORT>': {e}","messagePattern":"invalid value '(.+?)' for '(.+?)=<HOST_AND_PORT>': (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"libs/dcore/src/main.rs","lineNumber":180,"sourceCode":"  strace_ops_summary: bool,\n  v8_flags: Vec<String>,\n}\n\nimpl Args {\n  /// Returns `Ok(None)` when `--help` was requested (usage already printed).\n  fn parse(\n    args: impl IntoIterator<Item = String>,\n  ) -> Result<Option<Self>, Error> {\n    let mut out = Args::default();\n    let mut file_path: Option<String> = None;\n    let mut seen_inspect_flag: Option<&'static str> = None;\n\n    // `--inspect*` takes its value only via `=` (clap's `require_equals`), so\n    // `--inspect 1.2.3.4:9229` treats the address as the positional argument.\n    let parse_addr = |flag: &str, value: Option<&str>| match value {\n      None => Ok(None),\n      Some(v) => v.parse::<SocketAddr>().map(Some).map_err(|e| {\n        anyhow::anyhow!(\"invalid value '{v}' for '{flag}=<HOST_AND_PORT>': {e}\")\n      }),\n    };\n\n    for arg in args {\n      let (name, value) = match arg.split_once('=') {\n        Some((name, value)) => (name, Some(value)),\n        None => (arg.as_str(), None),\n      };\n      match name {\n        \"-h\" | \"--help\" => {\n          println!(\"{USAGE}\");\n          return Ok(None);\n        }\n        \"--inspect\" | \"--inspect-brk\" | \"--inspect-wait\" => {\n          if let Some(previous) = seen_inspect_flag {\n            bail!(\"the argument '{previous}' cannot be used with '{name}'\");\n          }\n          seen_inspect_flag = Some(match name {","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/libs/dcore/src/main.rs#L162-L198","documentation":"The minimal dcore runtime parses --inspect* flags itself: the value must be attached with `=` and must parse as a std SocketAddr, i.e. a literal IP plus port. Hostnames such as `localhost` do not parse as SocketAddr, so `--inspect=localhost:9229` fails with this message wrapping the parse error.","triggerScenarios":"Launching dcore with `--inspect=localhost:9229`, a bare port (`--inspect=:9229`), or any non-IP:PORT value; also `--inspect 127.0.0.1:9229` (space form) which treats the address as the positional script argument.","commonSituations":"Copy-pasting inspector flags from mainline `deno` docs (which resolve hostnames) into dcore; VS Code launch.json configs using localhost; unbracketed IPv6 addresses.","solutions":["Use a numeric IP: `--inspect=127.0.0.1:9229` or `--inspect=0.0.0.0:9229`","Bracket IPv6 addresses: `--inspect=[::1]:9229`","Keep the `=` form — with a space the address becomes the positional argument and the flag has no value"],"exampleFix":"# before — hostname is not a SocketAddr\ndcore --inspect=localhost:9229 main.js\n\n# after — numeric IP, attached with '='\ndcore --inspect=127.0.0.1:9229 main.js","handlingStrategy":"validation","validationCode":"addr=\"${INSPECT_ADDR:-127.0.0.1:9229}\"\nif ! printf '%s' \"$addr\" | grep -Eqx '(\\[?[0-9a-fA-F:.]+\\]?)?:?[0-9]+'; then\n  echo \"inspect address must be IP:PORT (no hostnames): '$addr'\"; exit 1\nfi\ndcore --inspect=\"$addr\" main.js","typeGuard":"fn valid_inspect_addr(v: &str) -> bool {\n  v.parse::<std::net::SocketAddr>().is_ok()\n}","tryCatchPattern":null,"preventionTips":["Use numeric IPs: 127.0.0.1:9229, 0.0.0.0:9229, [::1]:9229 — localhost is rejected","Attach the value with `=`; a space makes the address a positional argument","Point debugger configs (VS Code launch.json) at 127.0.0.1 rather than localhost for dcore targets"],"tags":["cli","inspect","debugger","args","dcore"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}