{"record":{"id":"e3ca8dd6a7b0f34e","repo":"denoland/deno","slug":"unexpected-argument-arg-found","errorCode":null,"errorMessage":"unexpected argument '{arg}' found","messagePattern":"unexpected argument '(.+?)' found","errorType":"validation","errorClass":"AnyError","httpStatus":null,"severity":"error","filePath":"libs/dcore/src/main.rs","lineNumber":225,"sourceCode":"            // `--inspect-brk` is accepted but not wired up to the inspector\n            // server, matching the previous clap-based behavior.\n            _ => {}\n          }\n        }\n        \"--strace-ops\" => out.strace_ops = true,\n        \"--strace-ops-summary\" => out.strace_ops_summary = true,\n        \"--v8-flags\" => {\n          let Some(value) = value else {\n            bail!(\"equal sign is needed when assigning values to '--v8-flags'\");\n          };\n          out.v8_flags.extend(value.split(',').map(String::from));\n        }\n        _ if name.starts_with('-') && name != \"-\" => {\n          bail!(\"unexpected argument '{name}' found\");\n        }\n        _ => {\n          if file_path.is_some() {\n            bail!(\"unexpected argument '{arg}' found\");\n          }\n          file_path = Some(arg);\n        }\n      }\n    }\n\n    let Some(file_path) = file_path else {\n      bail!(\n        \"the following required arguments were not provided:\\n  <file_path>\"\n      );\n    };\n    out.file_path = file_path;\n    Ok(Some(out))\n  }\n\n  fn inspect(&self) -> Option<(SocketAddr, InspectMode)> {\n    let default = || \"127.0.0.1:9229\".parse::<SocketAddr>().unwrap();\n    if let Some(addr) = self.inspect {","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/libs/dcore/src/main.rs#L207-L243","documentation":"dcore accepts exactly one positional argument — the script file to run. The first non-option token becomes file_path; any additional non-option token hits the `file_path.is_some()` guard and bails as unexpected. There is no `--` extra-args passthrough in dcore.","triggerScenarios":"`dcore a.js b.js`; or an option value accidentally detached so it parses as positional — notably `--inspect 127.0.0.1:9229 app.js`, since inspect takes its address only via `=`, leaving the address as a stray second positional.","commonSituations":"Trying to pass script arguments on the command line; forgetting the `=` on an inspect flag so host:port lands as a positional; wrapper scripts forwarding arbitrary args.","solutions":["Pass only the entry file: `dcore app.js`.","If you meant an inspect address, use the equals form: `--inspect=host:port`.","If your script needs runtime arguments, read them inside the script (env vars, prompts) — dcore forwards no extra args."],"exampleFix":"# before\ndcore --inspect 127.0.0.1:9229 app.js   # address becomes a second positional\n# error: unexpected argument '127.0.0.1:9229' found\n\n# after\ndcore --inspect=127.0.0.1:9229 app.js","handlingStrategy":"validation","validationCode":"# allow exactly one positional argument\npos=0\nfor a in \"$@\"; do case \"$a\" in -*) ;; *) pos=$((pos+1));; esac; done\n[ \"$pos\" -gt 1 ] && { echo \"dcore accepts exactly one <file_path>\"; exit 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Attach flag values with `=` (e.g. --inspect=host:port) so they never become positionals.","Pass runtime configuration to dcore scripts via env vars, not trailing CLI args.","Quote and count arguments in wrappers that forward user input."],"tags":["cli","arguments","dcore","positional-args"],"backgroundTag":"unexpected-positional-argument","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}