{"record":{"id":"3c2de1750120b7e6","repo":"denisidoro/navi","slug":"unable-to-process-value","errorCode":null,"errorMessage":"Unable to process value","messagePattern":"Unable to process value","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/commands/preview/var.rs","lineNumber":97,"sourceCode":"                \"\".to_string()\n            };\n\n            let replacement = format!(\n                \"{variable}\",\n                variable = style(bracketed_variable_name).with(variable_color),\n            );\n\n            colored_snippet = colored_snippet.replace(bracketed_variable_name, &replacement);\n\n            variables = format!(\n                \"{variables}\\n{variable} = {value}\",\n                variables = variables,\n                variable = style(variable_name).with(variable_color),\n                value = if env_var::get(&env_variable_name).is_ok() {\n                    value\n                } else if is_current {\n                    finder::process(value, column, delimiter.as_deref(), map.clone())\n                        .expect(\"Unable to process value\")\n                } else {\n                    \"\".to_string()\n                }\n            );\n        }\n\n        println!(\"{snippet}\", snippet = deser::fix_newlines(&colored_snippet));\n        println!(\"{variables}\");\n\n        process::exit(0)\n    }\n}\n","sourceCodeStart":79,"sourceCodeEnd":110,"githubUrl":"https://github.com/denisidoro/navi/blob/f7330b9ad5bd95b7d1a3c96d00e0a77deb589147/src/commands/preview/var.rs#L79-L110","documentation":"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\".","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the variable's underlying command manually and confirm it emits output containing the expected column","Check the variable's delimiter/column settings in the snippet config match the command output format","Verify the configured finder binary is installed and on PATH","Patch the preview code to surface `finder::process`'s error via `?` instead of panicking"],"exampleFix":"// before\nfinder::process(value, column, delimiter.as_deref(), map.clone()).expect(\"Unable to process value\")\n// after\nfinder::process(value, column, delimiter.as_deref(), map.clone())?","handlingStrategy":"validation","validationCode":"let out = std::process::Command::new(\"sh\").arg(\"-c\").arg(&value).output()?;\nif !out.status.success() || out.stdout.is_empty() {\n    eprintln!(\"variable command produces no output; preview will fail\");\n}","typeGuard":"fn processable(value: &str, column: Option<usize>) -> bool {\n    !value.trim().is_empty() && column.map_or(true, |c| value.split_whitespace().count() > c)\n}","tryCatchPattern":"match finder::process(value, column, delimiter, map) {\n    Ok(v) => v,\n    Err(e) => { eprintln!(\"preview: cannot process value: {e}\"); String::new() }\n}","preventionTips":["Test dynamic variable commands manually before adding them to snippets","Make sure delimiter/column settings match the command's actual output","Keep the finder binary installed for preview to work","Run preview inside a TTY-capable terminal"],"tags":["rust","panic","preview","finder","variables"],"backgroundTag":"finder-selection-failed","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"}