helix-editor/helix · error
--log must specify a path to write
Error message
--log must specify a path to write
What it means
The --log option requires a file path to write the log to; when no following token exists (argv.next() returned None) the parser bails. The value becomes args.log_file, overriding the default log location for this session.
Source
Thrown at helix-term/src/args.rs:78
},
"--health" => {
args.health = true;
args.health_arg = argv.next_if(|opt| !opt.starts_with('-'));
}
"-g" | "--grammar" => match argv.next().as_deref() {
Some("fetch") => args.fetch_grammars = true,
Some("build") => args.build_grammars = true,
_ => {
anyhow::bail!("--grammar must be followed by either 'fetch' or 'build'")
}
},
"-c" | "--config" => match argv.next().as_deref() {
Some(path) => args.config_file = Some(path.into()),
None => anyhow::bail!("--config must specify a path to read"),
},
"--log" => match argv.next().as_deref() {
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)
}View on GitHub (pinned to 079a789e8c)
Solutions
- Supply a writable path: hx --log /tmp/helix.log -v
- Ensure the directory exists and is writable (the log file is created/truncated)
- For verbosity, combine with -v..vvvv; only the file path goes to --log
Example fix
# before hx --log # after hx --log /tmp/helix.log -v file.rs
Defensive patterns
Strategy: validation
Validate before calling
# Ensure the log path is writable before launching
LOG="${LOG:-/tmp/helix.log}"
touch "$LOG" 2>/dev/null || { echo "cannot write $LOG" >&2; exit 2; }
exec hx --log "$LOG" -v "$@" Prevention
- Follow --log with a concrete writable file path
- Create the parent directory first
- Keep verbosity flags (-v..vvvv) separate from the log path
When it happens
Trigger: 'hx --log' as the final argument, or followed by another flag the user expected to be the log target's prefix; script truncation dropping the path.
Common situations: Copy-pasting a log command with the path lost in formatting; intending '--log <file> -v' but omitting the file; Windows path quoting issues leaving an empty next token after shell parsing.
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
- --working-dir specified does not exist or is not a directory
AI-assisted analysis of helix-editor/helix@079a789e8c (2026-08-16).
Data as JSON: /api/errors/f51dc0405401af38.
Report an issue: GitHub.