{"record":{"id":"c824219c3525b032","repo":"helix-editor/helix","slug":"config-must-specify-a-path-to-read","errorCode":null,"errorMessage":"--config must specify a path to read","messagePattern":"--config must specify a path to read","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"helix-term/src/args.rs","lineNumber":74,"sourceCode":"                },\n                \"--hsplit\" => match args.split {\n                    Some(_) => anyhow::bail!(\"can only set a split once of a specific type\"),\n                    None => args.split = Some(Layout::Horizontal),\n                },\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                    }","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/helix-editor/helix/blob/079a789e8cb08ead67f19e1971a1b7438b37354b/helix-term/src/args.rs#L56-L92","documentation":"The -c/--config option requires a path to the config file to read; when it is the last argument or the next token is consumed as missing (argv.next() returned None), the parser bails. The value is stored as args.config_file and used instead of the default config.toml for this run.","triggerScenarios":"'hx -c' with nothing after it; trailing space where the shell strips the intended value; 'hx --config' at end of a script line truncated by line-splitting.","commonSituations":"Line wrapping in docs/scripts losing the path argument; using '~' unquoted so the shell expands oddly; forgetting that --config takes ONE path (not multiple).","solutions":["Provide the path: hx -c /path/to/config.toml file.txt","Quote paths with spaces: hx -c \"my config.toml\"","Note ~ is expanded by the shell, not Helix - keep it unquoted or use $HOME explicitly"],"exampleFix":"# before\nhx -c\n\n# after\nhx -c ~/.config/helix/config.toml main.rs","handlingStrategy":"validation","validationCode":"# Shell: fail fast when the config path is missing/unreadable\nCFG=\"${CFG:-$HOME/.config/helix/config.toml}\"\n[ -r \"$CFG\" ] || { echo \"config not readable: $CFG\" >&2; exit 2; }\nexec hx -c \"$CFG\" \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always type a path right after -c/--config","Quote paths containing spaces","Check line-wrapped commands before running them"],"tags":["rust","helix","cli","args","config"],"backgroundTag":null,"analyzedSha":"079a789e8cb08ead67f19e1971a1b7438b37354b","analyzedAt":"2026-08-16T09:09:59.668Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}