denisidoro/navi · error

Unable to process value

Error message

Unable to process value

What it means

In the variable preview command (`preview var`), values that are not already plain env vars are computed by delegating to the finder pipeline via `finder::process`. The code `expect`s the result, so if the finder subprocess fails to parse/produce a value for the column, the preview panics with "Unable to process value".

Source

Thrown at src/commands/preview/var.rs:97

                "".to_string()
            };

            let replacement = format!(
                "{variable}",
                variable = style(bracketed_variable_name).with(variable_color),
            );

            colored_snippet = colored_snippet.replace(bracketed_variable_name, &replacement);

            variables = format!(
                "{variables}\n{variable} = {value}",
                variables = variables,
                variable = style(variable_name).with(variable_color),
                value = if env_var::get(&env_variable_name).is_ok() {
                    value
                } else if is_current {
                    finder::process(value, column, delimiter.as_deref(), map.clone())
                        .expect("Unable to process value")
                } else {
                    "".to_string()
                }
            );
        }

        println!("{snippet}", snippet = deser::fix_newlines(&colored_snippet));
        println!("{variables}");

        process::exit(0)
    }
}

View on GitHub (pinned to f7330b9ad5)

Solutions

  1. Run the variable's underlying command manually and confirm it emits output containing the expected column
  2. Check the variable's delimiter/column settings in the snippet config match the command output format
  3. Verify the configured finder binary is installed and on PATH
  4. Patch the preview code to surface `finder::process`'s error via `?` instead of panicking

Example fix

// before
finder::process(value, column, delimiter.as_deref(), map.clone()).expect("Unable to process value")
// after
finder::process(value, column, delimiter.as_deref(), map.clone())?
Defensive patterns

Strategy: validation

Validate before calling

let out = std::process::Command::new("sh").arg("-c").arg(&value).output()?;
if !out.status.success() || out.stdout.is_empty() {
    eprintln!("variable command produces no output; preview will fail");
}

Type guard

fn processable(value: &str, column: Option<usize>) -> bool {
    !value.trim().is_empty() && column.map_or(true, |c| value.split_whitespace().count() > c)
}

Try / catch

match finder::process(value, column, delimiter, map) {
    Ok(v) => v,
    Err(e) => { eprintln!("preview: cannot process value: {e}"); String::new() }
}

Prevention

When it happens

Trigger: Calling `preview` on a command/variable whose value requires finder processing (dynamic value with a column/delimiter) and `finder::process` returns `Err` — e.g. the underlying command fails, the delimiter/column doesn't match any output, or the finder binary errors.

Common situations: Previewing a variable whose dynamic command emits nothing (so column extraction fails); wrong `delimiter` configured for the snippet variable; finder binary missing or failing in the preview environment.

Related errors


AI-assisted analysis of denisidoro/navi@f7330b9ad5 (2026-09-03). Data as JSON: /api/errors/3c2de1750120b7e6. Report an issue: GitHub.