{"record":{"id":"89644facf0de3fb6","repo":"gitbutlerapp/gitbutler","slug":"the-picker-was-configured-to-not-allow-multiple-picks-yet","errorCode":null,"errorMessage":"the picker was configured to not allow multiple picks, yet multiple picks were returned","messagePattern":"the picker was configured to not allow multiple picks, yet multiple picks were returned","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/utils/output_channel.rs","lineNumber":514,"sourceCode":"        let Some(picks) = tui::run_picker(\n            self,\n            prompt.as_ref(),\n            items,\n            PickerOptions {\n                allow_multiple: false,\n                default_selected: Vec::new(),\n                disabled: Vec::new(),\n            },\n        )?\n        else {\n            return Ok(None);\n        };\n\n        match &picks[..] {\n            [] => Ok(None),\n            [pick] => Ok(Some(pick)),\n            _ => {\n                anyhow::bail!(\n                    \"the picker was configured to not allow multiple picks, yet multiple picks were returned\"\n                )\n            }\n        }\n    }\n\n    pub fn prompt_multi_select<'a, Key, Value>(\n        &mut self,\n        prompt: impl AsRef<str>,\n        items: &'a NonEmpty<(Key, Value)>,\n    ) -> anyhow::Result<Option<Vec<&'a Value>>>\n    where\n        Key: std::fmt::Display,\n    {\n        tui::run_picker(\n            self,\n            prompt.as_ref(),\n            items,","sourceCodeStart":496,"sourceCodeEnd":532,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/utils/output_channel.rs#L496-L532","documentation":"`prompt_select` drives the interactive picker in single-select mode; it asserts that the picker returns at most one pick. If the picker backend returns multiple picks despite being configured for single selection, this bail fires, indicating a broken contract with the picker.","triggerScenarios":"Calling `OutputChannel::prompt_select` (single-select helper) where the underlying picker returns a picks vector with more than one element — a picker-implementation or configuration bug, not a user-input error.","commonSituations":"Custom or mocked picker implementations returning multiple selections while `multiple` is disabled; version mismatches between the picker component and this wrapper.","solutions":["Check the picker configuration: ensure multi-select is disabled end-to-end and the backend honors it","If a custom/test picker is in use, make it return at most one pick","Report a bug if the built-in picker emits multiple picks in single-select mode"],"exampleFix":"// custom picker before\nOk(vec![a, b])\n// after\nOk(vec![a]) // single-select pickers must return at most one pick","handlingStrategy":"try-catch","validationCode":"// when supplying a custom picker, assert its contract before use\nassert!(picker.max_selections() <= 1, \"prompt_select requires a single-select picker\");","typeGuard":"fn single_pick(picks: &[Pick]) -> Option<&Pick> { picks.get(0).filter(|_| picks.len() == 1) }","tryCatchPattern":"let pick = match channel.prompt_select(prompt) {\n    Ok(p) => p,\n    Err(e) if e.to_string().contains(\"multiple picks\") => return Err(anyhow!(\"picker misconfigured: single-select returned multiple picks\")),\n    Err(e) => return Err(e),\n};","preventionTips":["Ensure the picker backend honors single-selection configuration","Keep picker wrappers and the underlying prompt library versions in sync","Cover single-select prompts with tests using a compliant mock picker"],"tags":["interactive","picker","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}