Hmbown/CodeWhale · error · anyhow::Error
browser URL cannot be empty
Error message
browser URL cannot be empty
What it means
Guard in open_url, the single codebase-wide entry point for opening URLs: the url argument was empty or whitespace-only. An empty URL would be handed to the platform open command (open/xdg-open/cmd /C start) and fail opaquely there, so it is rejected up front before a browser command is built.
Source
Thrown at crates/tui/src/utils.rs:513
/// - Windows: `cmd /C start ""`
/// - Other: returns an error.
///
/// This is the single entry point for URL opening — every call site in
/// the codebase should use this instead of hardcoding `Command::new("open")`,
/// `Command::new("xdg-open")`, or `Command::new("cmd")`.
pub fn open_url(url: &str) -> Result<()> {
let mut command = browser_open_command(url)?;
command
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.spawn()
.map(|_| ())
.map_err(|e| anyhow::anyhow!("failed to launch browser command: {e}"))
}
fn browser_open_command(url: &str) -> Result<Command> {
if url.trim().is_empty() {
return Err(anyhow::anyhow!("browser URL cannot be empty"));
}
#[cfg(target_os = "macos")]
{
let mut command = Command::new("open");
command.arg(url);
Ok(command)
}
#[cfg(any(
all(target_os = "linux", not(target_env = "ohos")),
target_os = "netbsd",
target_os = "freebsd",
target_os = "openbsd",
target_os = "dragonfly"
))]
{
let mut command = Command::new("xdg-open");View on GitHub (pinned to 0c42157ee5)
Solutions
- Ensure the URL is non-empty before calling open_url.
- Check upstream data flow so the link variable is populated from the actual event or response.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tui/src/utils.rs:513 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/e81a4a322e3b0304.
Report an issue: GitHub.