denoland/deno · error · AnyError
the argument '{previous}' cannot be used with '{name}'
Error message
the argument '{previous}' cannot be used with '{name}' What it means
The `dcore` runtime binary (Deno's minimal core runner) accepts `--inspect`, `--inspect-brk` and `--inspect-wait`, but only one per invocation. The parser records the first seen in `seen_inspect_flag`; any subsequent `--inspect*` flag bails naming both the previous and the new flag. Each flag also accepts an optional `=host:port` value.
Source
Thrown at libs/dcore/src/main.rs:196
None => Ok(None),
Some(v) => v.parse::<SocketAddr>().map(Some).map_err(|e| {
anyhow::anyhow!("invalid value '{v}' for '{flag}=<HOST_AND_PORT>': {e}")
}),
};
for arg in args {
let (name, value) = match arg.split_once('=') {
Some((name, value)) => (name, Some(value)),
None => (arg.as_str(), None),
};
match name {
"-h" | "--help" => {
println!("{USAGE}");
return Ok(None);
}
"--inspect" | "--inspect-brk" | "--inspect-wait" => {
if let Some(previous) = seen_inspect_flag {
bail!("the argument '{previous}' cannot be used with '{name}'");
}
seen_inspect_flag = Some(match name {
"--inspect" => "--inspect",
"--inspect-brk" => "--inspect-brk",
_ => "--inspect-wait",
});
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" => {View on GitHub (pinned to 9ad36f7a2c)
Solutions
- Keep exactly one inspector flag — prefer `--inspect-wait` for debugging (waits for the debugger before running user code) or plain `--inspect`.
- Edit the launch config/alias so the flags are not stacked.
- Run `dcore -h` to confirm the supported flag set.
Example fix
# before dcore --inspect --inspect-brk app.js # error: the argument '--inspect' cannot be used with '--inspect-brk' # after: exactly one inspector flag dcore --inspect-wait app.js
Defensive patterns
Strategy: validation
Validate before calling
# reject stacked --inspect* flags before invoking dcore
n=0
for a in "$@"; do
case "$a" in --inspect|--inspect-brk|--inspect-wait|--inspect=*|--inspect-brk=*|--inspect-wait=*) n=$((n+1));; esac
done
[ "$n" -gt 1 ] && { echo "only one --inspect* flag is allowed"; exit 2; } Prevention
- Standardize launch configs on a single inspector flag (--inspect-wait for debugging).
- Lint debug snippets/templates that append inspector flags to existing commands.
- Remember --inspect-brk is accepted but not wired to the inspector server in dcore — prefer --inspect-wait.
When it happens
Trigger: Invoking dcore with two inspector flags in one command: `dcore --inspect --inspect-wait app.js`, `dcore --inspect-brk --inspect=127.0.0.1:9230 app.js`, or any other pairing of the three.
Common situations: Editor/IDE debug launch configs that append `--inspect` to a template that already contains `--inspect-brk`; copy-pasted commands combining 'break at start' and 'wait for debugger' variants.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- equal sign is needed when assigning values to '--v8-flags'
- unexpected argument '{name}' found
- unexpected argument '{arg}' found
- the following required arguments were not provided: <file_
- ERR_INSPECTOR_ALREADY_ACTIVATED
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/7891ba12871d385b.
Report an issue: GitHub.