denoland/deno · error · AnyError
unexpected argument '{name}' found
Error message
unexpected argument '{name}' found What it means
`dcore`'s hand-rolled parser recognizes only `-h`/`--help`, the three `--inspect*` flags, `--strace-ops`, `--strace-ops-summary`, and `--v8-flags=<value>`. Any other token beginning with `-` (except the bare `-` marker) falls to the catch-all arm and bails as an unexpected argument.
Source
Thrown at libs/dcore/src/main.rs:221
let addr = parse_addr(name, value)?;
match name {
"--inspect" => out.inspect = Some(addr),
"--inspect-wait" => out.inspect_wait = Some(addr),
// `--inspect-brk` is accepted but not wired up to the inspector
// server, matching the previous clap-based behavior.
_ => {}
}
}
"--strace-ops" => out.strace_ops = true,
"--strace-ops-summary" => out.strace_ops_summary = true,
"--v8-flags" => {
let Some(value) = value else {
bail!("equal sign is needed when assigning values to '--v8-flags'");
};
out.v8_flags.extend(value.split(',').map(String::from));
}
_ if name.starts_with('-') && name != "-" => {
bail!("unexpected argument '{name}' found");
}
_ => {
if file_path.is_some() {
bail!("unexpected argument '{arg}' found");
}
file_path = Some(arg);
}
}
}
let Some(file_path) = file_path else {
bail!(
"the following required arguments were not provided:\n <file_path>"
);
};
out.file_path = file_path;
Ok(Some(out))
}View on GitHub (pinned to 9ad36f7a2c)
Solutions
- Remove flags dcore does not support — list them with `dcore -h`.
- Use the full `deno` binary when you need permission/watch/reload flags; dcore is the minimal core runner with only inspect/strace/v8 flags.
- Fix typos in supported flags (e.g. `--strace-ops`, not `--strace-op`).
Example fix
# before dcore --allow-read --quiet app.js # error: unexpected argument '--allow-read' found # after: dcore has no permission system or quiet flag dcore app.ts # need those flags? use deno: deno run --allow-read --quiet app.ts
Defensive patterns
Strategy: validation
Validate before calling
# flag allowlist check for dcore invocations
for a in "$@"; do
case "$a" in
-h|--help|--inspect|--inspect-brk|--inspect-wait|--strace-ops|--strace-ops-summary|-) ;;
--inspect=*|--inspect-brk=*|--inspect-wait=*|--v8-flags=*) ;;
-*) echo "dcore does not support: $a" ;;
esac
done Prevention
- Check `dcore -h` when porting deno command lines — dcore has no permission/watch/reload flags.
- Keep separate aliases for deno and dcore invocations instead of editing flags ad hoc.
- In wrappers, validate args against the allowlist before forwarding.
When it happens
Trigger: Passing full-Deno CLI flags to dcore: `dcore --allow-read app.js`, `--quiet`, `--reload`, `--watch`; or a typo like `--strace-op` (missing the s). Flags dcore does implement always parse via their exact names.
Common situations: Muscle memory from `deno run` flags (permissions, watch, reload); scripts or aliases originally written for the deno binary; docs copied between the two CLIs.
Related errors
- the argument '{previous}' cannot be used with '{name}'
- equal sign is needed when assigning values to '--v8-flags'
- unexpected argument '{arg}' found
- the following required arguments were not provided: <file_
- Invalid type for fetch: must be a function
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/6282d2e39fbae11a.
Report an issue: GitHub.