{"record":{"id":"f51dc0405401af38","repo":"helix-editor/helix","slug":"log-must-specify-a-path-to-write","errorCode":null,"errorMessage":"--log must specify a path to write","messagePattern":"--log must specify a path to write","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"helix-term/src/args.rs","lineNumber":78,"sourceCode":"                },\n                \"--health\" => {\n                    args.health = true;\n                    args.health_arg = argv.next_if(|opt| !opt.starts_with('-'));\n                }\n                \"-g\" | \"--grammar\" => match argv.next().as_deref() {\n                    Some(\"fetch\") => args.fetch_grammars = true,\n                    Some(\"build\") => args.build_grammars = true,\n                    _ => {\n                        anyhow::bail!(\"--grammar must be followed by either 'fetch' or 'build'\")\n                    }\n                },\n                \"-c\" | \"--config\" => match argv.next().as_deref() {\n                    Some(path) => args.config_file = Some(path.into()),\n                    None => anyhow::bail!(\"--config must specify a path to read\"),\n                },\n                \"--log\" => match argv.next().as_deref() {\n                    Some(path) => args.log_file = Some(path.into()),\n                    None => anyhow::bail!(\"--log must specify a path to write\"),\n                },\n                \"-w\" | \"--working-dir\" => match argv.next().as_deref() {\n                    Some(path) => {\n                        args.working_directory = if Path::new(path).is_dir() {\n                            Some(PathBuf::from(path))\n                        } else {\n                            anyhow::bail!(\n                                \"--working-dir specified does not exist or is not a directory\"\n                            )\n                        }\n                    }\n                    None => {\n                        anyhow::bail!(\"--working-dir must specify an initial working directory\")\n                    }\n                },\n                arg if arg.starts_with(\"--\") => {\n                    anyhow::bail!(\"unexpected double dash argument: {}\", arg)\n                }","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/helix-editor/helix/blob/079a789e8cb08ead67f19e1971a1b7438b37354b/helix-term/src/args.rs#L60-L96","documentation":"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.","triggerScenarios":"'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.","commonSituations":"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.","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"],"exampleFix":"# before\nhx --log\n\n# after\nhx --log /tmp/helix.log -v file.rs","handlingStrategy":"validation","validationCode":"# Ensure the log path is writable before launching\nLOG=\"${LOG:-/tmp/helix.log}\"\ntouch \"$LOG\" 2>/dev/null || { echo \"cannot write $LOG\" >&2; exit 2; }\nexec hx --log \"$LOG\" -v \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Follow --log with a concrete writable file path","Create the parent directory first","Keep verbosity flags (-v..vvvv) separate from the log path"],"tags":["rust","helix","cli","args","logging"],"backgroundTag":null,"analyzedSha":"079a789e8cb08ead67f19e1971a1b7438b37354b","analyzedAt":"2026-08-16T09:09:59.668Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}