{"record":{"id":"0b053e545d1b8ae7","repo":"denisidoro/navi","slug":"no-url-specified","errorCode":null,"errorMessage":"No URL specified","messagePattern":"No URL specified","errorType":"exception","errorClass":"anyhow","httpStatus":null,"severity":"warning","filePath":"src/common/url.rs","lineNumber":10,"sourceCode":"use crate::common::shell::{self, ShellSpawnError};\nuse crate::prelude::*;\nuse anyhow::Result;\nuse shell::EOF;\n\npub fn open(args: Vec<String>) -> Result<()> {\n    let url = args\n        .into_iter()\n        .next()\n        .ok_or_else(|| anyhow!(\"No URL specified\"))?;\n    let code = r#\"\nexst() {\n   type \"$1\" &>/dev/null\n}\n\n_open_url() { \n    local -r url=\"$1\"\n    if exst xdg-open; then\n        xdg-open \"$url\" &disown\n    elif exst open; then\n        echo \"$url\" | xargs -I% open \"%\"\n    else\n        exit 55\n    fi\n}\"#;\n    let cmd = format!(\n        r#\"{code}\n                ","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/denisidoro/navi/blob/f7330b9ad5bd95b7d1a3c96d00e0a77deb589147/src/common/url.rs#L1-L28","documentation":"`common::url::open` opens a URL in the user's browser via an embedded shell script. It takes the URL from the first argument of the args Vec; if the Vec is empty, `.next()` yields None and it returns `anyhow!(\"No URL specified\")`. It's a guard against calling the opener with nothing to open.","triggerScenarios":"`url::open(vec![])` or any caller passing an empty args list — the command/alias that should carry the URL argument provided none.","commonSituations":"Invoking navi's URL-opening command/widget without selecting text or supplying an argument, keybinding wired to the wrong command, or shell quoting dropping an empty argument.","solutions":["Pass the URL as the first argument: `navi ... <url>` or supply the selection to the widget","Check the keybinding/config invoking the opener to ensure it forwards the argument","Quote arguments in shell so they aren't dropped when empty","Wrap the call to handle the Result instead of letting it bubble up"],"exampleFix":"// before\nurl::open(vec![])?; // Error: No URL specified\n// after\nlet args: Vec<String> = std::env::args().skip(1).collect();\nif args.is_empty() { eprintln!(\"usage: open <url>\"); return Ok(()); }\nurl::open(args)?;","handlingStrategy":"validation","validationCode":"fn open_url(args: &[String]) -> anyhow::Result<()> {\n    if args.is_empty() {\n        anyhow::bail!(\"usage: open <url>\");\n    }\n    navi::common::url::open(args.to_vec())\n}","typeGuard":null,"tryCatchPattern":"match url::open(args) {\n    Ok(()) => {},\n    Err(e) if e.to_string() == \"No URL specified\" => {\n        eprintln!(\"no URL argument provided; check your keybinding/config forwards the selection\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Ensure the invoking command/keybinding forwards the URL argument","Quote shell arguments so empty values aren't silently dropped","Check args length before calling url::open","Test URL-opening widgets with a known-good URL"],"tags":["url","missing-argument","input-validation"],"backgroundTag":"missing-required-argument","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"}