nikivdev/code · warning

no package selected

Error message

no package selected

What it means

prompt_flox_package pipes the formatted search entries into fzf for interactive selection. If fzf exits with a non-zero status — most commonly because the user pressed Esc/Ctrl-C, or fzf failed to start properly — the function bails with 'no package selected'.

Source

Thrown at src/install.rs:588

            "--with-nth=1,3",
            "--prompt=flox> ",
            "--preview=echo Version: {2}\\n\\n{3}",
            "--preview-window=right,60%,wrap",
        ])
        .stdin(std::process::Stdio::piped())
        .stdout(std::process::Stdio::piped())
        .spawn()
        .context("failed to spawn fzf")?;

    child
        .stdin
        .as_mut()
        .context("failed to open fzf stdin")?
        .write_all(input.as_bytes())?;

    let output = child.wait_with_output()?;
    if !output.status.success() {
        bail!("no package selected");
    }

    let selection = String::from_utf8(output.stdout).context("fzf output was not valid UTF-8")?;
    let selected = selection.trim().split('\t').next().unwrap_or("");
    if selected.is_empty() {
        bail!("no package selected");
    }
    Ok(selected.to_string())
}

#[derive(Clone, Debug, Deserialize)]
struct FloxSearchEntry {
    #[serde(rename = "pkg_path")]
    pkg_path: String,
    description: Option<String>,
    version: Option<String>,
}

View on GitHub (pinned to a747e741ae)

Solutions

  1. Select a package in the fzf UI instead of cancelling (Esc/Ctrl-C)
  2. Run interactively in a real TTY rather than piping/capturing output
  3. Check FZF_DEFAULT_OPTS or fzf wrapper scripts for flags causing non-zero exits
  4. Handle the error upstream in run and surface a friendly 'cancelled' message
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure an interactive TTY before invoking the picker
if !std::io::stdin().is_terminal() {
    eprintln!("Interactive selection requires a TTY; pass a package name instead");
    std::process::exit(2);
}

Try / catch

match prompt_flox_package() {
    Err(e) if e.to_string() == "no package selected" => {
        eprintln!("Selection cancelled by user");
        return Ok(()); // treat as benign cancel
    }
    other => other?,
}

Prevention

When it happens

Trigger: fzf exits non-zero: user aborts selection, terminal lacks a TTY in scripted runs, or fzf is killed. Distinguished from the empty-selection case at line 594 which handles blank output with exit code 0.

Common situations: Running the installer non-interactively (CI, piped stdin) where fzf cannot present a UI; user cancels the picker; misconfigured fzf (FZF_DEFAULT_OPTS) causing non-zero exit.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/d5558b452b988456. Report an issue: GitHub.