helix-editor/helix · error
unexpected double dash argument: {}
Error message
unexpected double dash argument: {} What it means
Catch-all for any unrecognized long option: after all known '--' flags are matched, any argument starting with '--' that is not '--' itself (the literal separator) bails with 'unexpected double dash argument: <arg>'. This is Helix's unknown-option error, deliberately distinguishing long flags from the short-flag cluster handling that follows.
Source
Thrown at helix-term/src/args.rs:95
Some(path) => args.log_file = Some(path.into()),
None => anyhow::bail!("--log must specify a path to write"),
},
"-w" | "--working-dir" => match argv.next().as_deref() {
Some(path) => {
args.working_directory = if Path::new(path).is_dir() {
Some(PathBuf::from(path))
} else {
anyhow::bail!(
"--working-dir specified does not exist or is not a directory"
)
}
}
None => {
anyhow::bail!("--working-dir must specify an initial working directory")
}
},
arg if arg.starts_with("--") => {
anyhow::bail!("unexpected double dash argument: {}", arg)
}
arg if arg.starts_with('-') => {
let arg = arg.get(1..).unwrap().chars();
for chr in arg {
match chr {
'v' => args.verbosity += 1,
'V' => args.display_version = true,
'h' => args.display_help = true,
_ => anyhow::bail!("unexpected short arg {}", chr),
}
}
}
"+" => line_number = usize::MAX,
arg if arg.starts_with('+') => {
match arg[1..].parse::<usize>() {
Ok(n) => line_number = n.saturating_sub(1),
_ => insert_file_with_position(arg),
};View on GitHub (pinned to 079a789e8c)
Solutions
- Check 'hx --help' for the supported long options and correct the flag
- Use the '--' separator if the token is actually a FILE whose name starts with '--': hx -- --weird-filename
- Update scripts after Helix upgrades - flags occasionally move (e.g. grammar/log/config/working-dir all take values)
Example fix
# before hx --wait file.rs # after hx file.rs hx -- --strange-file-name # to open a file starting with --
Defensive patterns
Strategy: validation
Validate before calling
# Script guard: verify long flags against the known set before exec
known='--version --help --strict --tutor --vsplit --hsplit --health --grammar --config --log --working-dir --'
for a in "$@"; do
case " $known " in
*" $a "*) ;;
--*) echo "unknown flag: $a" >&2; hx --help >&2; exit 2;;
esac
done
exec hx "$@" Prevention
- Consult 'hx --help' before using a long flag - muscle memory from other tools misleads
- Use '--' to pass filenames that start with '--'
- Re-check flag names after upgrading Helix; prefer the short forms (-v -V -h) where available
When it happens
Trigger: 'hx --nushell', 'hx --vs-split', 'hx --file a.txt' - any typo'd or unsupported long flag. Note everything after a bare '--' is treated as filenames and never reaches this arm.
Common situations: Flags from other editors' muscle memory (--wait, --new-window, --diff); typos (--vplits); flags removed or renamed across Helix versions; scripts written against clap-style flag sets that don't exist here.
Related errors
- expected a path to file, but found a directory: {file:?}. (t
- can only set a split once of a specific type
- --grammar must be followed by either 'fetch' or 'build'
- --config must specify a path to read
- --log must specify a path to write
AI-assisted analysis of helix-editor/helix@079a789e8c (2026-08-16).
Data as JSON: /api/errors/61521ab4203e2a0a.
Report an issue: GitHub.