{"record":{"id":"040e2751e481bb1a","repo":"denisidoro/navi","slug":"no-command-and-options-captured-in-the-line","errorCode":null,"errorMessage":"No command and options captured in the line `{}`","messagePattern":"No command and options captured in the line `(.+?)`","errorType":"validation","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"src/parser.rs","lineNumber":98,"sourceCode":"        (false, true) => SuggestionType::SingleSelection,\n    };\n    opts.suggestion_type = suggestion_type;\n\n    Ok(opts)\n}\n\nfn parse_variable_line(line: &str) -> Result<(&str, &str, Option<FinderOpts>)> {\n    let caps = VAR_LINE_REGEX\n        .captures(line)\n        .ok_or_else(|| anyhow!(\"No variables, command, and options found in the line `{}`\", line))?;\n    let variable = caps\n        .get(1)\n        .ok_or_else(|| anyhow!(\"No variable captured in the line `{}`\", line))?\n        .as_str()\n        .trim();\n    let mut command_plus_opts = caps\n        .get(2)\n        .ok_or_else(|| anyhow!(\"No command and options captured in the line `{}`\", line))?\n        .as_str()\n        .split(\"---\");\n    let command = command_plus_opts\n        .next()\n        .ok_or_else(|| anyhow!(\"No command captured in the line `{}`\", line))?;\n    let command_options = command_plus_opts.next().map(parse_opts).transpose()?;\n    Ok((variable, command, command_options))\n}\n\nfn without_prefix(line: &str) -> String {\n    // The prefix character (#, %, @) is always 1-byte ASCII.\n    // Skip it and let trim() handle any whitespace separator, including\n    // multi-byte whitespace like non-breaking space (\\u{a0}).\n    line.get(1..).unwrap_or(\"\").trim().to_string()\n}\n\n#[derive(Clone, Default)]\npub struct FilterOpts {","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/denisidoro/navi/blob/f7330b9ad5bd95b7d1a3c96d00e0a77deb589147/src/parser.rs#L80-L116","documentation":"Thrown by `parse_variable_line` in src/parser.rs when capture group 2 (the command-and-options section after the variable) is missing from the regex match. The variable was found, but there is no command portion to execute.","triggerScenarios":"A variable line matching the regex for the variable part but lacking the command after the colon, e.g. `#my-var:` with nothing following, or a line where the separator layout prevents group 2 from capturing.","commonSituations":"Config lines where the command was deleted but the variable definition kept; line truncation from editors or copy-paste; writing only options without a command before `---`.","solutions":["Add the command after the variable and colon, e.g. `#my-var: cat file.txt`","Remove the now-empty variable definition if it is no longer needed","Check the file for truncated lines and restore the full definition"],"exampleFix":"// before\n#my-var:\n// after\n#my-var: cat file.txt --- --prompt \"Pick:\"","handlingStrategy":"validation","validationCode":"let has_command = |line: &str| {\n    line.split_once(':').map_or(false, |(_, rhs)| !rhs.trim().is_empty())\n};\n// require has_command(line) before parsing","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair a variable definition with a command after the colon","Delete the whole line if the command is gone — don't keep a bare variable","Check for editor/clipboard truncation when pasting long lines"],"tags":["parsing","regex","config"],"backgroundTag":"regex-capture-missing","analyzedSha":"f7330b9ad5bd95b7d1a3c96d00e0a77deb589147","analyzedAt":"2026-09-03T13:58:22.429Z","contentChangedAt":"2026-09-03T13:58:22.429Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}